public void Add_StoreInventory() { var store = new OnlineStore(new Catalog()); Assert.AreEqual(store.CheckInventory(ProductTypeEnum.Tent), 9); Assert.AreEqual(store.CheckInventory(ProductTypeEnum.SleepingBag), 3); }
public void AddItemToCart_TakeoutFromInventory() { var store = new OnlineStore(new Catalog()); var customerName = CustomerName; store.CreateShoppingCart(customerName); bool hasInventory = store.CheckInventory(ProductTypeEnum.Tent) >= 10; Assert.IsFalse(hasInventory); hasInventory = store.CheckInventory(ProductTypeEnum.Tent) >= 5; Assert.IsTrue(hasInventory); store.AddItemToShoppingCart(customerName, ProductTypeEnum.Tent, 5); int tentInInventory = store.CheckInventory(ProductTypeEnum.Tent); Assert.AreEqual(tentInInventory, 4); Assert.AreEqual(5, store.GetItemCountInCart(customerName, ProductTypeEnum.Tent)); }
public void Initialize_StoreInventory() { var store = new OnlineStore(new Catalog()); Assert.AreEqual(store.CheckInventory(ProductTypeEnum.Tent), 9); Assert.AreEqual(store.CheckInventory(ProductTypeEnum.SleepingBag), 3); Assert.AreEqual(store.CheckInventory(ProductTypeEnum.Backpack), 7); Assert.AreEqual(store.CheckInventory(ProductTypeEnum.Stove), 16); Assert.AreEqual(store.CheckInventory(ProductTypeEnum.GranolaBar), 30); Assert.AreEqual(store.CheckInventory(ProductTypeEnum.TrailMix), 19); Assert.AreEqual(store.CheckInventory(ProductTypeEnum.DehydratedMeal), 30); Assert.AreEqual(store.CheckInventory(ProductTypeEnum.Coffee), 42); }
public void RemoveItemFromCart_ReturnsToInventory() { var store = new OnlineStore(new Catalog()); var customerName = CustomerName; store.CreateShoppingCart(customerName); bool hasInventory = store.CheckInventory(ProductTypeEnum.Tent) >= 5; Assert.IsTrue(hasInventory); store.AddItemToShoppingCart(customerName, ProductTypeEnum.Tent, 5); int tentInInventory = store.CheckInventory(ProductTypeEnum.Tent); Assert.AreEqual(tentInInventory, 4); Assert.AreEqual(5, store.GetItemCountInCart(customerName, ProductTypeEnum.Tent)); // now take one item from cart store.RemoveItemFromShoppingCart(customerName, ProductTypeEnum.Tent, 1); // show be 4 left in cart Assert.AreEqual(4, store.GetItemCountInCart(customerName, ProductTypeEnum.Tent)); // inventory should have 5 tentInInventory = store.CheckInventory(ProductTypeEnum.Tent); Assert.AreEqual(tentInInventory, 5); }