public async Task ShouldRaiseError_UpdateLoanAgreement_UsingInvalidLoanID() { var model = new EditLoanAgreementInfo { Id = new Guid("0000c20b-6df0-4313-98a5-7c3561757dc2"), LoanAmount = 70000, InterestRate = .12, LoanDate = new DateTime(2021, 1, 5), MaturityDate = new DateTime(2023, 1, 5), PaymentsPerYear = 24, UserId = UserId.Create(new Guid("660bb318-649e-470d-9d2b-693bfb0b2744")) }; await Assert.ThrowsAsync <InvalidOperationException>(async() => await _cmdHdlr.Handle(model)); }
public async Task ShouldUpdate_LoanAgreement_UsingEditLoanAgreementInfoWriteModel() { var model = new EditLoanAgreementInfo { Id = new Guid("1511c20b-6df0-4313-98a5-7c3561757dc2"), LoanAmount = 70000, InterestRate = .12, LoanDate = new DateTime(2021, 1, 5), MaturityDate = new DateTime(2023, 1, 5), PaymentsPerYear = 24, UserId = UserId.Create(new Guid("660bb318-649e-470d-9d2b-693bfb0b2744")) }; await _cmdHdlr.Handle(model); LoanAgreement result = await _dbContext.LoanAgreements.FindAsync(model.Id); Assert.Equal(model.LoanAmount, result.LoanAmount); Assert.Equal(model.InterestRate, result.InterestRate); Assert.Equal(model.PaymentsPerYear, result.PaymentsPerYear); Assert.Equal(model.MaturityDate, result.MaturityDate); }