Enhance logging in FdsSqlOptions and related classes

- Updated FdsSqlOptions to accept an optional ILogger parameter for improved error logging.
- Modified FdsMfr and FdsMfrClient classes to pass the logger instance to FdsSqlOptions.
- Added detailed error logging in various methods to capture SQL execution issues and file handling errors.
- Improved documentation for FdsSqlOptions to clarify logging behavior.
- Updated Archive class to log compression errors, enhancing traceability of failures.
- Adjusted project configuration to suppress specific warnings related to transitive dependencies.
- Added NuGet.config to define package sources for dependency management.
- Updated submodule references for OCORE and related projects.
This commit is contained in:
Stefan
2026-07-03 20:22:05 +02:00
parent 1a3bf30442
commit 882e97509a
57 changed files with 2121 additions and 106 deletions
+66
View File
@@ -377,4 +377,70 @@ public class BankingDualFormatTests
Assert.Equal("ZIP Sender", t.Rows[0]["NameOfPayer"]);
Assert.Equal("ZIP Zahlung", t.Rows[0]["SepaRemittanceInformation"]);
}
/// <summary>
/// Schema whose string columns carry the same MaxLength as the real
/// <c>fds__tt__bankingtransactions</c> table type. Building it here lets the tests
/// catch width-overflow bugs that <see cref="BankingService.BuildDefaultSchema"/> (which
/// uses unconstrained strings) cannot. Only the columns exercised below are constrained.
/// </summary>
private static DataTable DbLikeSchema()
{
var t = new DataTable();
t.Columns.Add("AccountIdentification", typeof(string)).MaxLength = 50;
t.Columns.Add("Amount", typeof(decimal));
t.Columns.Add("ValueDate", typeof(DateTime));
t.Columns.Add("FundsCode", typeof(string)).MaxLength = 1; // VARCHAR(1) — currency "EUR" must not land here
t.Columns.Add("NameOfPayer", typeof(string)).MaxLength = 60;
t.Columns.Add("PostingText", typeof(string)).MaxLength = 30;
t.Columns.Add("TransactionTypeIdCode", typeof(string)).MaxLength = 3;
t.Columns.Add("SepaRemittanceInformation", typeof(string)).MaxLength = 200;
t.Columns.Add("DebitCreditMark", typeof(string)).MaxLength = 2;
return t;
}
[Fact]
public void ParseToDatatable_Camt_WithDbWidthSchema_StillImportsRows()
{
// Regression: CAMT wrote the ISO currency ("EUR") into FundsCode (VARCHAR(1)).
// Against the real DB widths that overflowed and — swallowed per entry — dropped
// every transaction, so nothing reached the database.
using var s = ToStream(Camt053);
var t = Svc.ParseToDatatable(s, schemaDatatable: DbLikeSchema());
Assert.Equal(1, t.Rows.Count);
Assert.Equal("DE12345678901234567890", t.Rows[0]["AccountIdentification"]);
Assert.Equal(500.00m, t.Rows[0]["Amount"]);
// Currency is no longer forced into the 1-char FundsCode column.
Assert.Equal(DBNull.Value, t.Rows[0]["FundsCode"]);
}
[Fact]
public void ParseToDatatable_Camt_OverlongFields_AreTruncatedNotDropped()
{
const string longName = "Ein sehr langer Zahlungspflichtiger Name der weit ueber sechzig Zeichen hinausgeht GmbH Co KG";
string camt = """
<?xml version="1.0"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.053.001.02">
<BkToCstmrStmt><Stmt>
<Acct><Id><IBAN>DE12345678901234567890</IBAN></Id><Ccy>EUR</Ccy></Acct>
<Ntry>
<Amt Ccy="EUR">500.00</Amt><CdtDbtInd>CRDT</CdtDbtInd>
<BookgDt><Dt>2023-01-15</Dt></BookgDt>
<NtryDtls><TxDtls>
<RltdPties><Dbtr><Nm>{NAME}</Nm></Dbtr></RltdPties>
<RmtInf><Ustrd>Rechnung</Ustrd></RmtInf>
</TxDtls></NtryDtls>
</Ntry>
</Stmt></BkToCstmrStmt>
</Document>
""".Replace("{NAME}", longName);
using var s = ToStream(camt);
var t = Svc.ParseToDatatable(s, schemaDatatable: DbLikeSchema());
Assert.Equal(1, t.Rows.Count);
Assert.Equal(60, ((string)t.Rows[0]["NameOfPayer"]).Length); // truncated to column width, row kept
Assert.Equal(longName[..60], t.Rows[0]["NameOfPayer"]);
}
}