コード例 #1
0
        public void GetQuntityStrategyResultForOneItem()
        {
            var cartList = new List <CartWithPromotionType>();

            cartList.Add(new CartWithPromotionType()
            {
                cart = new Cart()
                {
                    Quantity = 1,
                    SkuId    = 'A'
                },
                promotionType = PromotionTypes.Quantity
            });
            promotionStrategy = new QuantityPromotion(query);
            var result = promotionStrategy.ApplyPromotion(cartList);

            Assert.AreEqual(50, result);
        }
コード例 #2
0
        public void GetComboStrategyResultOnlyFirtOfCombo()
        {
            var cartList = new List <CartWithPromotionType>();

            cartList.Add(new CartWithPromotionType()
            {
                cart = new Cart()
                {
                    Quantity = 1,
                    SkuId    = 'C'
                },
                promotionType = PromotionTypes.Combo
            });
            promotionStrategy = new ComboPromotion(query);


            var result = promotionStrategy.ApplyPromotion(cartList);

            Assert.AreEqual(20, result);
        }