public void LoanApplication_Accepted_CannotBeRejected() { var application = new LoanApplicationBuilder() .WithCustomer(customer => customer.WithAge(25).WithIncome(15_000M)) .WithLoan(loan => loan.WithAmount(200_000).WithNumberOfYears(25).WithInterestRate(1.1M)) .WithProperty(prop => prop.WithValue(250_000M)) .Evaluated() .Accepted() .Build(); var user = new OperatorBuilder().WithLogin("admin").Build(); var ex = Assert.Throws <ApplicationException>(() => application.Reject(user)); Assert.Equal("Cannot reject application that is already accepted or rejected", ex.Message); }
public void LoanApplication_WithoutScore_CanBeRejected() { var application = new LoanApplicationBuilder() .WithCustomer(customer => customer.WithAge(25).WithIncome(15_000M)) .WithLoan(loan => loan.WithAmount(200_000).WithNumberOfYears(25).WithInterestRate(1.1M)) .WithProperty(prop => prop.WithValue(250_000M)) .NotEvaluated() .Build(); var user = new OperatorBuilder().WithLogin("admin").Build(); application.Reject(user); LoanApplicationAssert.That(application) .IsInStatus(LoanApplicationStatus.Rejected) .ScoreIsNull(); }