Esempio n. 1
0
        public async Task Test(TransactionViewModel transaction, IEnumerable <RateModel> rates, decimal expectedValue)
        {
            Mock <IRateService <RateModel> > service = new Mock <IRateService <RateModel> >();
            Mock <IDuplicateRatesCleaner>    duplicateRatesCleaner = new Mock <IDuplicateRatesCleaner>();

            service.Setup(opt => opt.TryGetRates()).ReturnsAsync(rates);
            duplicateRatesCleaner.Setup(opt => opt.DeletingDuplicates(rates)).Returns(rates);

            ICurrencyConverter   converter = new CurrencyConverter(service.Object, duplicateRatesCleaner.Object);
            TransactionViewModel result    = await converter.ApplyConversion(transaction);

            Assert.That(Equals(result.AmountConverted, expectedValue), $"Value expected {expectedValue}, value result {result.AmountConverted}");
        }