public void AttachPromotionToItemTest_itemNotInCart_nothingHappens() {
     ShoppingCart cart = new ShoppingCart();
     Item item = new Item("Apple");
     Item item2 = new Item("Bananas");
     cart.AddItem(item);
     cart.AttachPromotionToItem(item2, new QuantityPricePromotion(item2, "[email protected]"));
     LineItem lineItem = cart.GetLineItemForItem(item);
     Assert.IsNull(lineItem.Promotion);
 }
 public void AttachPromotionToItemTest_nullItem_expectException() {
     ShoppingCart cart = new ShoppingCart();
     cart.AttachPromotionToItem(null, new QuantityPricePromotion(new Item("Apple"), "[email protected]"));
 }
 public void AttachPromotionToItemTest_nullPromotion_expectException() {
     ShoppingCart cart = new ShoppingCart();
     cart.AttachPromotionToItem(new Item("Apple"), null);
 }
Exemple #4
0
 public void ApplyPromotion(ShoppingCart cart) {
     cart.AttachPromotionToItem(item, this);
 }