public void AddItemPromotionTest_addDuplicatePromotion_exceptionExpected() { PromotionModel model = new PromotionModel(new string[0]); Item item = new Item("Apple"); Dictionary<Item, Promotion> existingDictionary = new Dictionary<Item, Promotion>(); existingDictionary.Add(item, new QuantityPricePromotion(item, "[email protected]")); model.AddItemPromotion(existingDictionary, "Apple,QtyPromoPrice,[email protected]"); }
public void AddItemPromotionTest_addPromotion_itemAddedToDictionary() { PromotionModel model = new PromotionModel(new string[0]); Item item = new Item("Apple"); Dictionary<Item, Promotion> existingDictionary = new Dictionary<Item, Promotion>(); model.AddItemPromotion(existingDictionary, "Apple,QtyPromoPrice,[email protected]"); Assert.AreEqual(1, existingDictionary.Count); Assert.IsTrue(existingDictionary.ContainsKey(item)); Assert.IsTrue(existingDictionary[item] is QuantityPricePromotion); }