Esempio n. 1
0
 public CardApplicationResult(Card creditProduct, ICreditApplication creditApplication, bool acceptance)
 {
     CardID             = creditProduct.ID;
     ApplicationID      = creditApplication.ID;
     CardName           = creditProduct.CardName;
     Apr                = creditProduct.Apr;
     PromotionalMessage = creditProduct.PromotionalMessage;
     Accepted           = acceptance;
 }
        public void TestMatchCriteriaFalseWhenAgeOver()
        {
            IAgeMonthsCalculator ageCalculator     = new AgeProcessingService();
            ICreditApplication   creditApplication = CardApplicationTestExtensionMethods.SetupWithDefaultValues().PrepareCardApplicationWithDob(DateTime.Now.Date.AddYears(-50)).PrepareCardApplicationWithAnnualIncome(5);

            CreditProduct sut = new CreditProduct()
            {
                MinAgeMonths = 12, MaxAgeMonths = 100, MinIncomeGbp = 1, MaxIncomeGbp = 30
            };

            Assert.IsFalse(sut.MeetsCriteria(creditApplication, ageCalculator));
        }
        public bool MeetsCriteria(ICreditApplication creditApplication, IAgeMonthsCalculator ageCalculator)
        {
            decimal ageInMonths = creditApplication.GetApplicantAgeMonths(ageCalculator);

            if (ageInMonths < MinAgeMonths || ageInMonths > MaxAgeMonths)
            {
                return(false);
            }
            decimal incomeGbp = creditApplication.GetApplicantSalary();

            if (incomeGbp < MinIncomeGbp || incomeGbp > MaxIncomeGbp)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }