Beispiel #1
0
        public void ConvertSum_SumIsLessOrEqualZero_ExceptionThrown(decimal sum)
        {
            var client = new Mock <INationalBankKzClient>();
            KztCurrencyRateService service = new KztCurrencyRateService(client.Object);

            Assert.ThrowsAsync <ArgumentOutOfRangeException>(() => service.ConvertSum(sum, DateTime.Now));
        }
Beispiel #2
0
        public void ConvertSum_DateFromFuture_ExceptionThrown()
        {
            var client = new Mock <INationalBankKzClient>();
            KztCurrencyRateService service = new KztCurrencyRateService(client.Object);

            Assert.ThrowsAsync <ArgumentOutOfRangeException>(() => service.ConvertSum(10, DateTime.MaxValue));
        }
Beispiel #3
0
        public async void ConvertSum_CorrectInput_ReturnResult(DateTime date, NbRatesResponse response)
        {
            var client = new Mock <INationalBankKzClient>();

            client.Setup(p => p.GetRates(It.IsAny <DateTime>())).ReturnsAsync(response);
            KztCurrencyRateService service = new KztCurrencyRateService(client.Object);

            decimal expected = 87;
            decimal actual   = await service.ConvertSum(15, date);

            Assert.Equal(expected, actual, 1);
        }