Пример #1
0
        public async Task GetQuoteForeignCurrencyWhenResponseIsNotNullTest()
        {
            var request = new QuoteForeignCurrencyRequest
            {
                Amount   = 10,
                Currency = Currency.USD
            };

            _foreignExchangeRatesServiceMock.Setup(
                setup => setup.GetLatestExchangeRateAsync(request.Currency)
                ).ReturnsAsync(ForeignExchangeRatesResponseBuilder.ForeignExchangeRatesResponse(request.Currency));

            var service = new ExchangeRateService(
                _foreignExchangeRatesServiceMock.Object,
                _domainNotificationMock.Object,
                _exchangeRatePerSegmentMock.Object
                );
            var method = await service.GetQuoteForeignCurrencyAsync(request);

            Assert.IsType <ExchangeRateResponse>(method);
        }
Пример #2
0
        public async Task GetQuoteForeignCurrencyWhenExternalForeignExchangeRatesIsNullTest()
        {
            var request = new QuoteForeignCurrencyRequest
            {
                Amount   = 10,
                Currency = Currency.USD
            };
            ForeignExchangeRatesResponse response = null;

            _foreignExchangeRatesServiceMock.Setup(
                setup => setup.GetLatestExchangeRateAsync(request.Currency)
                ).ReturnsAsync(response);

            var service = new ExchangeRateService(
                _foreignExchangeRatesServiceMock.Object,
                _domainNotificationMock.Object,
                _exchangeRatePerSegmentMock.Object
                );
            var method = await service.GetQuoteForeignCurrencyAsync(request);

            Assert.Null(method);
        }