示例#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);
        }
示例#2
0
        public void ApplyPromotionWithEmptyCart()
        {
            IPromotionEngine engine = new EngineService.PromotionEngine();

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

            engine.ApplyPromotion(null);
        }