public void Constructor_SetCreditStoreBand_High() { var calculatorFloor = new CreditScoreCalculator(851); Assert.Equal(CreditScoreBands.High, calculatorFloor.CreditScoreBand); var calculatorCeiling = new CreditScoreCalculator(1000); Assert.Equal(CreditScoreBands.High, calculatorCeiling.CreditScoreBand); }
public void Constructor_SetCreditStoreBand_Medium() { var calculatorFloor = new CreditScoreCalculator(701); Assert.Equal(CreditScoreBands.Medium, calculatorFloor.CreditScoreBand); var calculatorCeiling = new CreditScoreCalculator(850); Assert.Equal(CreditScoreBands.Medium, calculatorCeiling.CreditScoreBand); }
public void Constructor_SetCreditStoreBand_Low() { var calculatorFloor = new CreditScoreCalculator(451); Assert.Equal(CreditScoreBands.Low, calculatorFloor.CreditScoreBand); var calculatorCeiling = new CreditScoreCalculator(700); Assert.Equal(CreditScoreBands.Low, calculatorCeiling.CreditScoreBand); }
public void Constructor_SetCreditStoreBand_Ineligible() { var calculatorFloor = new CreditScoreCalculator(0); Assert.Equal(CreditScoreBands.Ineligible, calculatorFloor.CreditScoreBand); var calculatorCeiling = new CreditScoreCalculator(450); Assert.Equal(CreditScoreBands.Ineligible, calculatorCeiling.CreditScoreBand); }
public decimal CalculateCredit(Customer customer) { var creditScoreCalculator = new CreditScoreCalculator(customer.BureauScore); var missedPaymentsCalculator = new MissedPaymentsCalculator(customer.MissedPaymentCount); var completedPaymentsCalculator = new CompletedPaymentsCalculator(customer.CompletedPaymentCount); if (creditScoreCalculator.CreditScoreBand == CreditScoreBands.Ineligible) { throw new InvalidCreditScoreException("Customer's credit score is too low."); } var maximumPoints = creditScoreCalculator.GetScore() + missedPaymentsCalculator.GetScore() + completedPaymentsCalculator.GetScore(); var ageAdjustedPoints = ApplyAgePointsCeiling(maximumPoints, customer.AgeInYears); return(CalculateAvailableCreditFromPoints(ageAdjustedPoints)); }
public void GetScore_High() { var calculator = new CreditScoreCalculator(925); Assert.Equal(3, calculator.GetScore()); }
public void GetScore_Medium() { var calculator = new CreditScoreCalculator(800); Assert.Equal(2, calculator.GetScore()); }
public void GetScore_Low() { var calculator = new CreditScoreCalculator(600); Assert.Equal(1, calculator.GetScore()); }
public void GetScore_Ineligible() { var calculator = new CreditScoreCalculator(200); Assert.Throws <IneligibleCreditScoreException>(() => calculator.GetScore()); }