public void AssignPromotionsToShoppingCartItemsTest_promotionNotFoundForItem_noPromotionAssigned() { string[] pricings = new string[] { "Apple, 1.00" }; string[] promotions = new string[] { "Bananas, QtyPromoPrice, [email protected]" }; Item item = new Item("Apple"); ShoppingCart cart = new ShoppingCart(); cart.AddItem(item); LineItem lineItem = cart.GetLineItemForItem(item); Assert.IsNull(lineItem.Promotion); PricingController pricingController = new PricingController(pricings, promotions); pricingController.AssignPromotionsToShoppingCartItems(cart); Assert.IsNull(lineItem.Promotion); }
public void AssignPricingToShoppingCartItemsTest_pricingAssignedToLineItem() { string[] pricings = new string[] { "Apple, 1.00" }; string[] promotions = new string[0]; Item item = new Item("Apple"); ShoppingCart cart = new ShoppingCart(); cart.AddItem(item); LineItem lineItem = cart.GetLineItemForItem(item); Assert.AreEqual(0, lineItem.PricePerUnit); PricingController pricingController = new PricingController(pricings, promotions); pricingController.AssignPricingToShoppingCartItems(cart); Assert.AreEqual(1.00, lineItem.PricePerUnit); }