Esempio n. 1
0
        public void TestBasketPurchasePolicy_MaxBasketPriceInValid()
        {
            cart.AddProduct(store, 2, 2, false);
            cart.AddProduct(store, 3, 2, false);
            PurchaseBasket basket           = cart.GetBasket(store);
            PurchasePolicy purchaseplc      = new BasketPurchasePolicy(maxBasketPrice: 100, pre: preConditionsDict[CommonStr.PurchasePreCondition.MaxBasketPrice]);
            bool           eligiblePurchase = purchaseplc.IsEligiblePurchase(basket);

            Assert.AreEqual(false, eligiblePurchase);
        }
Esempio n. 2
0
        public void TestBasketPurchasePolicy_NoCondtion()
        {
            cart.AddProduct(store, 2, 2, false);
            cart.AddProduct(store, 3, 2, false);
            PurchaseBasket basket           = cart.GetBasket(store);
            PurchasePolicy purchaseplc      = new BasketPurchasePolicy(pre: preConditionsDict[CommonStr.PurchasePreCondition.allwaysTrue]);
            bool           eligiblePurchase = purchaseplc.IsEligiblePurchase(basket);

            Assert.AreEqual(true, eligiblePurchase);
        }
Esempio n. 3
0
        public void TestBasketPurchasePolicy_MinItemPerBasketValid()
        {
            cart.AddProduct(store, 1, 2, false);
            cart.AddProduct(store, 2, 2, false);
            cart.AddProduct(store, 3, 2, false);
            PurchaseBasket basket           = cart.GetBasket(store);
            PurchasePolicy purchaseplc      = new BasketPurchasePolicy(minItems: 6, pre: preConditionsDict[CommonStr.PurchasePreCondition.MinItemsAtBasket]);
            bool           eligiblePurchase = purchaseplc.IsEligiblePurchase(basket);

            Assert.AreEqual(true, eligiblePurchase);
        }