示例#1
0
        public void Equals()
        {
            var cardA = CreditCard.BarclayCard();
            var cardB = CreditCard.BarclayCard();
            var cardC = CreditCard.Vanquis();

            Assert.IsTrue(cardA == cardB);
            Assert.IsFalse(cardB == cardC);
        }
示例#2
0
        public void Distinct()
        {
            List <CreditCard> list = new List <CreditCard>
            {
                CreditCard.BarclayCard(),
                              CreditCard.BarclayCard(),
                              CreditCard.Vanquis()
            };

            Assert.AreEqual(2, list.Distinct().Count());
        }
示例#3
0
        /// <summary>
        /// Determines what credit product is suitable for the applicant.
        /// </summary>
        /// <returns> new instance of applicant with their assigned credit product. </returns>
        public Applicant ApproveApplication()
        {
            if (Age > 18 && AnnualIncome > 30000)
            {
                return(new Applicant(this.Id, this.FirstName, this.LastName, this.DateOfBirth, this.AnnualIncome,
                                     CreditCard.BarclayCard()));
            }
            if (Age > 18)
            {
                return(new Applicant(this.Id, this.FirstName, this.LastName, this.DateOfBirth, this.AnnualIncome,
                                     CreditCard.Vanquis()));
            }

            return(this);
        }