public void RemoveCompositeDiscount_composedOfComposites_Success()
        {
            LoginSessionSuccess(REGISTERED_SESSION_ID, FIRST_OPENER_USERNAME, PASSWORD);
            ItemMinMaxPurchasePolicy policy1    = DeserialzeItemMinMaxSuccess(REGISTERED_SESSION_ID, FIRST_STORE_ID, FIRST_ITEM_FIRST_STORE_ID, 5, 10);
            ItemMinMaxPurchasePolicy policy2    = DeserialzeItemMinMaxSuccess(REGISTERED_SESSION_ID, FIRST_STORE_ID, SECOND_ITEM_FIRST_STORE_ID, 5, 10);
            CompositePurchasePolicy  composite1 = DeserializeCompositePurchasePolicySucces(REGISTERED_SESSION_ID, FIRST_STORE_ID, policy1.policyID,
                                                                                           policy2.policyID, "&");

            StoreMinMaxPurchasePolicy    policy3    = DeserialzeStoreMinMaxSuccess(REGISTERED_SESSION_ID, FIRST_STORE_ID, 5, 10);
            DaysNotAllowedPurchasePolicy policy4    = DeserialzeDaysNotAllowedSucces(REGISTERED_SESSION_ID, FIRST_STORE_ID, new int[] { 1, 5, 7 });
            CompositePurchasePolicy      composite2 = DeserializeCompositePurchasePolicySucces(REGISTERED_SESSION_ID, FIRST_STORE_ID, policy3.policyID,
                                                                                               policy4.policyID, "|");

            CompositePurchasePolicy composite3 = DeserializeCompositePurchasePolicySucces(REGISTERED_SESSION_ID, FIRST_STORE_ID, composite1.policyID,
                                                                                          composite2.policyID, "xor");

            Assert.True(DeserializeRemovePurchasePolicySuccess(REGISTERED_SESSION_ID, FIRST_STORE_ID, composite3.policyID));
            Assert.False(marketFacade.DiscountExistsInStore(FIRST_STORE_ID, policy1.policyID));
            Assert.False(marketFacade.DiscountExistsInStore(FIRST_STORE_ID, policy2.policyID));
            Assert.False(marketFacade.DiscountExistsInStore(FIRST_STORE_ID, policy3.policyID));
            Assert.False(marketFacade.DiscountExistsInStore(FIRST_STORE_ID, policy4.policyID));
            Assert.False(marketFacade.DiscountExistsInStore(FIRST_STORE_ID, composite1.policyID));
            Assert.False(marketFacade.DiscountExistsInStore(FIRST_STORE_ID, composite2.policyID));
            Assert.False(marketFacade.DiscountExistsInStore(FIRST_STORE_ID, composite3.policyID));
        }
Пример #2
0
        public void daysNotAllowed_notValidTest()
        {
            DayOfWeek today = DateTime.Now.DayOfWeek;
            int       day   = (int)today + 1;
            DaysNotAllowedPurchasePolicy policy = new DaysNotAllowedPurchasePolicy(new int[] { day }, MOCK_NAME_FOR_DESCRIPTION);

            Assert.False(policy.IsValidPurchase(cart1With5));
        }
Пример #3
0
        public void daysNotAllowed_multpleDays_validTest()
        {
            DayOfWeek today = DateTime.Now.DayOfWeek;
            int       day   = (int)today + 2 == 8 ? 1 : (int)today + 2;
            int       day2  = (int)today + 3 == 8 ? 1 : (int)today + 3;
            DaysNotAllowedPurchasePolicy policy = new DaysNotAllowedPurchasePolicy(new int[] { day, day2 }, MOCK_NAME_FOR_DESCRIPTION);

            Assert.True(policy.IsValidPurchase(cart1With5));
        }