Exemple #1
0
        public async Task ShouldUpdate_LoanAgreement_UsingLoanAgreementRepo()
        {
            LoanAgreement agreement = await _loanAgreementRepo.GetByIdAsync(new Guid("09b53ffb-9983-4cde-b1d6-8a49e785177f"));

            agreement.UpdateInterestRate(InterestRate.Create(.0975));
            agreement.UpdateLoanAmount(LoanAmount.Create(52128M));

            await _unitOfWork.Commit();

            LoanAgreement result = await _loanAgreementRepo.GetByIdAsync(new Guid("09b53ffb-9983-4cde-b1d6-8a49e785177f"));

            Assert.Equal(.0975, result.InterestRate);
            Assert.Equal(52128M, result.LoanAmount);
        }
Exemple #2
0
        public static async Task Execute
        (
            EditLoanAgreementInfo model,
            ILoanAgreementAggregateRepository loanAgreementRepo,
            IUnitOfWork unitOfWork
        )
        {
            string        errMsg        = $"Unable to locate loan agreement with LoanId '{model.Id}'!";
            LoanAgreement loanAgreement = await loanAgreementRepo.GetByIdAsync(model.Id) ?? throw new InvalidOperationException(errMsg);

            loanAgreement.UpdateLoanAmount(LoanAmount.Create(model.LoanAmount));
            loanAgreement.UpdateInterestRate(InterestRate.Create(model.InterestRate));
            loanAgreement.UpdateLoanDate(LoanDate.Create(model.LoanDate));
            loanAgreement.UpdateMaturityDate(MaturityDate.Create(model.MaturityDate));
            loanAgreement.UpdatePaymentsPerYear(PaymentsPerYear.Create(model.PaymentsPerYear));
            loanAgreement.UpdateUserId(model.UserId);
            loanAgreement.UpdateLastModifiedDate();

            await unitOfWork.Commit();
        }