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

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

            _exchangeRatePerSegmentMock.Setup(setup => setup.Value)
            .Returns(ExchangeRatePerSegmentBuilder.ExchangeRatePerSegment);

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

            Assert.IsType <ExchangeRateResponse>(method);
        }
Пример #2
0
        public async Task GetForeignCurrencyConversionWhenExternalForeignExchangeRatesIsNullTest()
        {
            var request = new ForeignCurrencyConversionRequest
            {
                Amount          = 10,
                Currency        = Currency.USD,
                CustomerSegment = CustomerSegment.RETAIL
            };
            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.GetForeignCurrencyConversionAsync(request);

            Assert.Null(method);
        }