Ejemplo n.º 1
0
 public void Between500And1KTest()
 {
     Assert.IsTrue(_util.Between500And1K(1000));
     Assert.IsTrue(_util.Between500And1K(999));
     Assert.IsTrue(_util.Between500And1K(501));
     Assert.IsFalse(_util.Between500And1K(500));
 }
Ejemplo n.º 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
            });
        }