public async Task Get_ExistingAccountDifferentCustomerStatement_ShouldReturnNotFound() { var testAccountId = 1; var testCustomerId = 1; _mockMediator .Setup(m => m.Send(It.Is <AccountGetRequest>(a => a.AccountId == testAccountId && a.CustomerId == testCustomerId), default)) .ThrowsAsync(new NotFoundException()) .Verifiable(); var controller = new StatementController(Mapper, _mockMediator.Object); var result = await controller.Get(testAccountId, testCustomerId); _mockMediator.Verify(); Assert.True(typeof(NotFoundObjectResult) == result.Result.GetType()); }
public async Task Get_Statements_ShouldReturnStatements() { var testAccountId = 1; var testCustomerId = 1; var testAccount = GetTestAccount(testAccountId, testCustomerId); _mockMediator .Setup(m => m.Send(It.Is <AccountGetRequest>(a => a.AccountId == testAccountId && a.CustomerId == testCustomerId), default)) .ReturnsAsync(testAccount) .Verifiable(); var controller = new StatementController(Mapper, _mockMediator.Object); var result = await controller.Get(testAccountId, testCustomerId); _mockMediator.Verify(); Assert.True(typeof(StatementModel) == result.Value.GetType()); Assert.Equal(testAccount.Transactions.Count(), result.Value.Transactions.Count()); }