public async Task Create_DepositNonExistingAccount_ShouldReturnNotFound() { var request = new DepositCreateRequest { AccountId = 1, Ammount = 100, CustomerId = 2, Details = "Test" }; _mockMediator .Setup(m => m.Send(It.Is <DepositCreateRequest>(d => d.AccountId == request.AccountId && d.Ammount == request.Ammount && d.CustomerId == request.CustomerId && d.Details == request.Details), default)) .ThrowsAsync(new NotFoundException()) .Verifiable(); var controller = new DepositController(_mockMediator.Object); var result = await controller.Create(request); _mockMediator.Verify(); Assert.True(typeof(NotFoundObjectResult) == result.Result.GetType()); }
public async Task Create_DepositExistingAccount_ShouldReturnTransactions() { var request = new DepositCreateRequest { AccountId = 1, Ammount = 100, CustomerId = 2, Details = "Test" }; var depositTransactions = DepositTransactions(request); _mockMediator .Setup(m => m.Send(It.Is <DepositCreateRequest>(d => d.AccountId == request.AccountId && d.Ammount == request.Ammount && d.CustomerId == request.CustomerId && d.Details == request.Details), default)) .ReturnsAsync(depositTransactions) .Verifiable(); var controller = new DepositController(_mockMediator.Object); var result = await controller.Create(request); _mockMediator.Verify(); Assert.True(typeof(CreatedAtActionResult) == result.Result.GetType()); }