Exemple #1
0
        public async Task ShouldUpdate_LoanPayment_UsingLoanAgreementAggregate()
        {
            LoanAgreement agreement = await _loanAgreementRepo.GetByIdAsync(new Guid("1511c20b-6df0-4313-98a5-7c3561757dc2"));

            LoanPayment payment = agreement.LoanPayments.FirstOrDefault(p => p.Id == new Guid("2205ebde-58dc-4af7-958b-9124d9645b38"));

            payment.UpdatePaymentDueDate(PaymentDueDate.Create(new DateTime(2021, 1, 10)));
            payment.UpdateLoanInterestAmount(LoanInterestAmount.Create(360.07M));

            agreement.UpdateLoanPayment(payment);
            await _unitOfWork.Commit();

            LoanPayment result = agreement.LoanPayments.FirstOrDefault(p => p.Id == new Guid("2205ebde-58dc-4af7-958b-9124d9645b38"));

            Assert.Equal(new DateTime(2021, 1, 10), result.PaymentDueDate);
            Assert.Equal(360.07M, result.LoanInterestAmount);
        }