tests wähurngsverwaltung

This commit is contained in:
2026-04-17 08:09:31 +02:00
parent 0d3bd47f7a
commit 83a400a90e
7 changed files with 481 additions and 6 deletions
@@ -10,11 +10,13 @@ public class TransformationCatalogTests
ITransformationStrategy[] valueStrategies =
[
new CopyTransformationStrategy(),
new ConstantTransformationStrategy()
new ConstantTransformationStrategy(),
new NormalizeCurrencyCodeTransformationStrategy()
];
IRecordTransformationStrategy[] recordStrategies =
[
new FirstNonEmptyRecordTransformationStrategy()
new FirstNonEmptyRecordTransformationStrategy(),
new ConvertCurrencyRecordTransformationStrategy(new FakeCurrencyExchangeRateService())
];
var catalog = new TransformationCatalog(valueStrategies, recordStrategies);
@@ -23,6 +25,16 @@ public class TransformationCatalogTests
Assert.Contains(all, x => x.RuleScope == "Value" && x.Key == "Copy");
Assert.Contains(all, x => x.RuleScope == "Value" && x.Key == "Constant");
Assert.Contains(all, x => x.RuleScope == "Value" && x.Key == "NormalizeCurrencyCode");
Assert.Contains(all, x => x.RuleScope == "Record" && x.Key == "FirstNonEmpty");
Assert.Contains(all, x => x.RuleScope == "Record" && x.Key == "ConvertCurrency");
}
private sealed class FakeCurrencyExchangeRateService : ICurrencyExchangeRateService
{
public decimal? ResolveRate(string fromCurrency, string toCurrency, DateTime? effectiveDate) => 1m;
public string NormalizeCurrencyCode(string? currencyCode)
=> currencyCode?.Trim().ToUpperInvariant() ?? string.Empty;
}
}