public async Task ThrowValidationErrorWhenVoucherIdExist() { //Given CreateLedgerEntryCommand command = new CreateLedgerEntryCommand() { Description = "Testing Ledger entry working", Reference = "", VoucherId = "JV/001", Date = DateTime.Now.ToString(), Posted = 0, Entries = new List <NewLedgerEntryModel> () { new NewLedgerEntryModel() { Credit = 100, Debit = 0, AccountId = 1 }, new NewLedgerEntryModel() { Debit = 100, Credit = 0, AccountId = 2 } } }; //When //Then await Assert.ThrowsAsync <ValidationException> (() => handler.Handle(command, CancellationToken.None)); }
public async Task CreateEntrySuccessfuly() { // Arrange CreateLedgerEntryCommand command = new CreateLedgerEntryCommand() { Description = "Testing Ledger entry working", Reference = "", VoucherId = "JV/088", Date = DateTime.Now.ToString(), Posted = 0, Entries = new List <NewLedgerEntryModel> () { new NewLedgerEntryModel() { Credit = 100, Debit = 0, AccountId = 1 }, new NewLedgerEntryModel() { Debit = 100, Credit = 0, AccountId = 2 } } }; // Act var result = await handler.Handle(command, CancellationToken.None); // Assert Assert.NotEqual(0, result); }