public async Task GetExchange_OnCall_Success() { // Arrange var exchange = new GetExchangeResponse { BuyPrice = 30.0M, SellPrice = 40.0M }; _mockExternalService.GetExchangeAsync(_target.CurrencyName) .Returns(Task.FromResult(exchange)); // Act var result = await _target.GetExchange(); // Assert Assert.IsNotNull(result); }
public async Task GetExchangeAsync_OnDollar_Success() { // Arrange _currencyCode = "dolar"; // Act var result = await _target.GetExchangeAsync(_currencyCode); // Assert Assert.IsNotNull(result); }
public async Task <GetExchangeResponse> GetExchange() { GetExchangeResponse result = null; try { result = await _externalService.GetExchangeAsync(CurrencyName); } catch (Exception exception) { _logger.LogError(exception, "Unhandled exception"); } return(result); }