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); }
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); }