public async Task <IActionResult> GetAccountByIban(string accountIban) { var accountResponse = await customerAccountsService.GetAccountAsync(accountIban); if (accountResponse == null) { return(NotFound()); } return(Ok(accountResponse)); }
public async Task GetAccountByIban_WithAccountIbanExsits_ReturnStatusCodeOK() { // Arrange var accountIban = "AAAA"; var accountResponse = new AccountResponse { AccountIban = "AAAA", Balance = 1000 }; customerAccountsService .GetAccountAsync(Arg.Any <string>()) .Returns(Task.FromResult(accountResponse)); // Act var actionResult = await accountsController.GetAccountByIban(accountIban); var objectResult = actionResult as OkObjectResult; // Assert Assert.NotNull(objectResult); Assert.Equal(objectResult.StatusCode, (int)System.Net.HttpStatusCode.OK); }