コード例 #1
0
        public void WillNotProvideSpecialPriceWhenNotEnoughQty()
        {
            Dictionary<string, int> sales = new Dictionary<string, int>();
            sales.Add("A:3", 130);
            PriceRules specialRules = new PriceRules(sales);

            Assert.IsNull(specialRules.PriceCheck("A", 1));
        }
コード例 #2
0
        public void WillProvideSpecialPriceWhenEnoughQty(string sku, int qty, int sPrice)
        {
            Dictionary<string, int> sales = new Dictionary<string, int>();
            sales.Add(String.Format("{0}:{1}", sku, qty), sPrice);

            PriceRules specialRules = new PriceRules(sales);

            Assert.AreEqual(specialRules.PriceCheck(sku, qty), sPrice);
        }
コード例 #3
0
        public void WillProvideSpecialPriceWhenEnoughQty()
        {
            Dictionary<string, int> sales = new Dictionary<string, int>();
            sales.Add(String.Format("{0}:{1}", "A", 3), 130);
            sales.Add(String.Format("{0}:{1}", "B", 2), 45);

            PriceRules specialRules = new PriceRules(sales);

            Assert.AreEqual(specialRules.PriceCheck("A", 3), 130);
            Assert.AreEqual(specialRules.PriceCheck("B", 2), 45);
        }
コード例 #4
0
 public void WillNotProvideSpecialWhenNotOnSale()
 {
     Dictionary<string, int> sales = new Dictionary<string, int>();
     PriceRules specialRules = new PriceRules(sales);
     Assert.IsNull(specialRules.PriceCheck("A", 1));
 }