Пример #1
0
 public void Between2KAnd5KTest()
 {
     Assert.IsTrue(_util.Between2KAnd5K(4999));
     Assert.IsTrue(_util.Between2KAnd5K(5000));
     Assert.IsTrue(_util.Between2KAnd5K(2001));
     Assert.IsFalse(_util.Between2KAnd5K(2000));
 }
Пример #2
0
        public Discount GetBigSpenderDiscount(AccountHistory customerAccount)
        {
            var     discountType = DiscountType.BigSpenderDiscount;
            decimal discountValue;

            if (_util.SpendOver5K(customerAccount.YearlySpend))
            {
                discountValue = 2;
            }
            else if (_util.Between2KAnd5K(customerAccount.YearlySpend))
            {
                discountValue = 1;
            }
            else if (_util.Between1KAnd2K(customerAccount.YearlySpend))
            {
                discountValue = 0.5M;
            }
            else
            {
                if (_util.Between500And1K(customerAccount.YearlySpend))
                {
                    discountValue = 0.25M;
                }
                else
                {
                    discountType  = DiscountType.None;
                    discountValue = 0;
                }
            }

            return(new Discount
            {
                DiscountType = discountType,
                DiscountValue = discountValue
            });
        }