public async Task ThrowNotFoundExceptionWhenGivenNonExistingId() { // Arrange handler = new UpdateLedgerEntryCommandHandler(_Database); UpdateLedgerEntryCommand command = new UpdateLedgerEntryCommand() { Id = 2, Description = "updated Description", Date = DateTime.Now, Posted = 1, VoucherId = "JV/001", Reference = "CH--11", Entries = new List <UpdatedLedgerEntryModel> () { new UpdatedLedgerEntryModel() { Id = 10, Debit = 110, Credit = 0, AccountId = 10 }, new UpdatedLedgerEntryModel() { Id = 11, Debit = 0, Credit = 110, AccountId = 11 } } }; // Act await Assert.ThrowsAsync <NotFoundException> (() => handler.Handle(command, CancellationToken.None)); }
public async Task UpdateSuccessfully() { // Arrange handler = new UpdateLedgerEntryCommandHandler(_Database); UpdateLedgerEntryCommand command = new UpdateLedgerEntryCommand() { Id = 11, Description = "updated Description", Date = DateTime.Now, Posted = 0, VoucherId = "JV/001", Reference = "CH--11", Entries = new List <UpdatedLedgerEntryModel> () { new UpdatedLedgerEntryModel() { Id = 22, Debit = 110, Credit = 0, AccountId = 10 }, new UpdatedLedgerEntryModel() { Id = 23, Debit = 0, Credit = 110, AccountId = 11 } } }; // Act var result = await handler.Handle(command, CancellationToken.None); // Assert Assert.Equal(Unit.Value, result); }