public void TestRevealedDiscount1()
        {
            cart.AddProduct(store, 1, 10, false);
            PurchaseBasket basket      = cart.GetBasket(store);
            DiscountPolicy discountplc = new RevealdDiscount(1, 30);
            double         discount    = discountplc.CalcDiscount(basket);
            double         expected    = 30000;

            Assert.AreEqual(expected, discount);
        }
 // will return true iff <param> discountPolicy is a malformed discount, i.e failed
 // to parse, i.e if it is instance of RevealdDiscount with negative product id.
 public static bool checkDiscount(DiscountPolicy discountPolicy)
 {
     try
     {
         RevealdDiscount revealedDiscount = ((RevealdDiscount)discountPolicy);
         return(revealedDiscount.discountProdutId < 0 ? false : true);
     }
     catch (Exception)
     {
         return(true);
     }
 }
Пример #3
0
        //public DbPreCondition ToDbPurchasePreCondition(DiscountPreCondition preCondition)
        //{
        //    return new DbPreCondition(CommonStr.PreConditionType.DiscountPreCondition, preCondition.preCondNumber);
        //}

        public DbDiscountPolicy ToDbRevealdDiscountPolicy(RevealdDiscount revealdDiscount, int?parentid, int storeid)
        {
            return(new DbDiscountPolicy(storeid, null, parentid, null, revealdDiscount.discountProdutId, revealdDiscount.discount, CommonStr.DiscountPolicyTypes.RevealdDiscount, null, null, null, null));
        }