tests wähurngsverwaltung
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user