Add structured AI analysis output and invoice ID validation
This commit is contained in:
1 parent
12bc2a1822
commit
5b697ee200
8 files changed
+298
-16
No files matched your search
@@ -0,0 +1,40 @@
|
||||
using ImportAssist.Core;
|
||||
using Xunit;
|
||||
|
||||
namespace ImportAssist.Core.Tests;
|
||||
|
||||
public sealed class InvoiceAnalysisValidatorTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(null, true)]
|
||||
[InlineData("INV-001", true)]
|
||||
[InlineData("", false)]
|
||||
[InlineData(" ", false)]
|
||||
[InlineData("\t", false)]
|
||||
[InlineData("\r\n", false)]
|
||||
public void Validate_ChecksInvoiceIdContract(
|
||||
string? invoiceId,
|
||||
bool expectedValid)
|
||||
{
|
||||
var analysis = new InvoiceAnalysis(
|
||||
Summary: "Testanalyse",
|
||||
Findings:
|
||||
[
|
||||
new AnalysisFinding(
|
||||
LineNumber: 6,
|
||||
InvoiceId: invoiceId,
|
||||
RuleId: "INV-004",
|
||||
Description: "Betrag muss größer als null sein.",
|
||||
NextCheck: "Originalbetrag anhand des Belegs prüfen.",
|
||||
MissingInformation: ["Originalbetrag"])
|
||||
],
|
||||
Limitations: []);
|
||||
|
||||
var errors = InvoiceAnalysisValidator.Validate(analysis);
|
||||
|
||||
if (expectedValid)
|
||||
Assert.Empty(errors);
|
||||
else
|
||||
Assert.Single(errors);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user