Beispiel #1
0
        public void DiscountIsOneMilkWhenSevenMilkAndFourRequired()
        {
            SingleDiscountCalculator milkDiscount = new SingleDiscountCalculator(milk, 4, 1);

            Dictionary <Product, int> sevenMilk = new Dictionary <Product, int>
            {
                { milk, 7 }
            };

            decimal discount = milkDiscount.CalculateDiscount(sevenMilk);

            decimal expectedDiscount = milk.Cost;

            Assert.AreEqual(expectedDiscount, discount);
        }
Beispiel #2
0
        public void DiscountIsTwoMilkWhenEightMilkAndFourRequired()
        {
            SingleDiscountCalculator milkDiscount = new SingleDiscountCalculator(milk, 4, 1);

            Dictionary <Product, int> eightMilk = new Dictionary <Product, int>
            {
                { milk, 8 }
            };

            decimal discount = milkDiscount.CalculateDiscount(eightMilk);

            decimal expectedDiscount = milk.Cost * 2;

            Assert.AreEqual(expectedDiscount, discount);
        }
Beispiel #3
0
        public void DiscountIsZeroWhenThreeMilkAndFourRequired()
        {
            SingleDiscountCalculator milkDiscount = new SingleDiscountCalculator(milk, 4, 1);

            Dictionary <Product, int> threeMilk = new Dictionary <Product, int>
            {
                { milk, 3 }
            };

            decimal discount = milkDiscount.CalculateDiscount(threeMilk);

            decimal expectedDiscount = 0;

            Assert.AreEqual(expectedDiscount, discount);
        }