public void AddItemTest_withQuantity_itemNotInCartAlready_itemAddedWithQuantity() { ShoppingCart cart = new ShoppingCart(); Item item = new Item("Apple"); cart.AddItem(item, 3); Assert.IsTrue(cart.DoesCartContainItem(item)); Assert.AreEqual(3, cart.GetLineItemForItem(item).Quantity); }
public void AddItemTest_itemNotInCart_addsItem() { ShoppingCart cart = new ShoppingCart(); Assert.AreEqual(0, cart.CountOfItems); Item item = new Item("Apple"); cart.AddItem(item); Assert.IsTrue(cart.DoesCartContainItem(item)); Assert.AreEqual(1, cart.CountOfItems); }
public void AddItemTest_itemInCart_addsAdditionalItemToLineItemCount() { ShoppingCart cart = new ShoppingCart(); Item item = new Item("Apple"); cart.AddItem(item); Assert.IsTrue(cart.DoesCartContainItem(item)); Assert.AreEqual(1, cart.CountOfItems); cart.AddItem(item); Assert.AreEqual(1, cart.CountOfItems); LineItem lineItem = cart.GetLineItemForItem(item); Assert.AreEqual(2, lineItem.Quantity); }