Beispiel #1
0
        public void ApplyPromotionTestForScenarioC()
        {
            IPromotionEngine engine = new EngineService.PromotionEngine();

            Cart cart = new Cart();

            cart.Items = new List <CartItem>();
            cart.Items.Add(new CartItem()
            {
                Quantity    = 3,
                ProductInfo = new ProductInfo("A", 50)
            });
            cart.Items.Add(new CartItem()
            {
                Quantity    = 5,
                ProductInfo = new ProductInfo("B", 30)
            });
            cart.Items.Add(new CartItem()
            {
                Quantity    = 1,
                ProductInfo = new ProductInfo("C", 20)
            });
            cart.Items.Add(new CartItem()
            {
                Quantity    = 1,
                ProductInfo = new ProductInfo("D", 15)
            });

            engine.ApplyPromotion(cart);
            Assert.AreEqual(280, cart.TotalPrice);
        }
Beispiel #2
0
        public void ApplyPromotionWithEmptyCart()
        {
            IPromotionEngine engine = new EngineService.PromotionEngine();

            engine.ApplyPromotion(new Cart());
        }
Beispiel #3
0
        public void ApplyPromotionWithNull()
        {
            IPromotionEngine engine = new EngineService.PromotionEngine();

            engine.ApplyPromotion(null);
        }