Ejemplo n.º 1
0
        public void NewApplication_IsCreatedIn_NewStatus_AndNullScore()
        {
            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))
                              .Build();

            LoanApplicationAssert.That(application)
            .IsInStatus(LoanApplicationStatus.New)
            .ScoreIsNull();
        }
Ejemplo n.º 2
0
        public void InvalidApplication_EvaluationScore_IsRed_And_StatusIsRejected()
        {
            var application = new LoanApplicationBuilder()
                              .WithCustomer(customer => customer.WithAge(55).WithIncome(15_000M))
                              .WithLoan(loan => loan.WithAmount(200_000).WithNumberOfYears(25).WithInterestRate(1.1M))
                              .WithProperty(prop => prop.WithValue(250_000M))
                              .Build();

            application.Evaluate(scoringRulesFactory.DefaultSet);

            LoanApplicationAssert.That(application)
            .IsInStatus(LoanApplicationStatus.Rejected)
            .ScoreIs(ApplicationScore.Red);
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        public void LoanApplication_InStatusNew_EvaluatedGreen_OperatorHasCompetenceLevel_CanBeAccepted()
        {
            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()
                              .Build();

            var user = new OperatorBuilder()
                       .WithLogin("admin")
                       .WithCompetenceLevel(1_000_000M)
                       .Build();

            application.Accept(user);

            LoanApplicationAssert.That(application)
            .IsInStatus(LoanApplicationStatus.Accepted)
            .ScoreIs(ApplicationScore.Green);
        }