예제 #1
0
        public void GetTotalDiscount_HaveNothingFurnitureProductInBag_TotalDiscountShouldBeZero()
        {
            IDiscountor furnitureDiscountor   = GetFurnitureDiscountor(GetShoppingBagThatHaveNothingFurnitureProduct());
            double      expectedTotalDiscount = 0;
            double      actualTotalDiscount   = furnitureDiscountor.GetTotalDiscount();

            Assert.AreEqual(expectedTotalDiscount, actualTotalDiscount);
        }
예제 #2
0
        public void GetTotalDiscount_TotalFurnitureCostLesserThan500_TotalDiscountShouldBeZero()
        {
            IDiscountor furnitureDiscountor   = GetFurnitureDiscountor(GetShoppingBagThatHaveFurnitureProductTotalCostIs300());
            double      expectedTotalDiscount = 0;
            double      actualTotalDiscount   = furnitureDiscountor.GetTotalDiscount();

            Assert.AreEqual(expectedTotalDiscount, actualTotalDiscount);
        }
예제 #3
0
        public void GetTotalDiscount_HaveNothingMedicineProductInBag_TotalDiscountShouldBeZero(int customerAge)
        {
            IDiscountor medicineDiscountor = GetMedicineDiscountor(GetShoppingBagHaveNothingMedicineProduct(), GetCustomer(customerAge));
            double      expectedDiscount   = 0;
            double      actualDiscount     = medicineDiscountor.GetTotalDiscount();

            Assert.AreEqual(expectedDiscount, actualDiscount);
        }
예제 #4
0
        private static void ShowMedicineDiscount(IShoppingBag shoppingBag, ICustomer customer)
        {
            IDiscountor medicineDiscountor    = ShoppingFactory.GetMedicineDiscountor(shoppingBag, customer);
            double      medicineTotalDiscount = medicineDiscountor.GetTotalDiscount();

            if (medicineTotalDiscount > 0)
            {
                Console.WriteLine($"Discount from medicine promotion: ${ medicineTotalDiscount }");
            }
        }
예제 #5
0
        private static void ShowFurnitureDiscount(IShoppingBag shoppingBag)
        {
            IDiscountor furnitureDiscountor    = ShoppingFactory.GetFurnitureDiscountor(shoppingBag);
            double      furnitureTotalDiscount = furnitureDiscountor.GetTotalDiscount();

            if (furnitureTotalDiscount > 0)
            {
                Console.WriteLine($"Discount from furniture promotion: ${ furnitureTotalDiscount }");
            }
        }
예제 #6
0
        private static void ShowSnackDiscount(IShoppingBag shoppingBag)
        {
            IDiscountor snackDiscountor    = ShoppingFactory.GetBuyTwoGetOneFreeSnackDiscountor(shoppingBag);
            double      snackTotalDiscount = snackDiscountor.GetTotalDiscount();

            if (snackTotalDiscount > 0)
            {
                Console.WriteLine($"Discount from snack promotion: ${ snackTotalDiscount }");
            }
        }