public void AddProduct_AddingTwoProduct_TotalProductInBagShouldHaveTwo() { IShoppingBag shoppingBag = GetShoppingBag(); shoppingBag.AddProduct(GetProduct()); shoppingBag.AddProduct(GetProduct()); var products = shoppingBag.GetProductList(); int expectedTotalProducts = 2; int actualTotalProducts = products.Count(); Assert.AreEqual(expectedTotalProducts, actualTotalProducts); }
public void RemoveProduct_RemoveProductThatNotInBag_TotalProductShouldNotChange() { IShoppingBag shoppingBag = GetShoppingBag(); IProduct productInBag = GetProduct(); IProduct productNotInBag = GetProduct(); shoppingBag.AddProduct(productInBag); shoppingBag.RemoveProduct(productNotInBag); var products = shoppingBag.GetProductList(); int expectedTotalProducts = 1; int actualTotalProducts = products.Count(); Assert.AreEqual(expectedTotalProducts, actualTotalProducts); }
public void RemoveProduct_RemoveTwoProductFromTotalFive_TotalProductInBagShouldHaveThree() { IShoppingBag shoppingBag = GetShoppingBag(); IProduct testProduct = GetProduct(); for (int i = 0; i < 5; i++) { shoppingBag.AddProduct(testProduct); } for (int i = 0; i < 2; i++) { shoppingBag.RemoveProduct(testProduct); } var products = shoppingBag.GetProductList(); int expectedTotalProducts = 3; int actualTotalProducts = products.Count(); Assert.AreEqual(expectedTotalProducts, actualTotalProducts); }
private void SelectProduct() { MessageLogger.ShowSelectProductNumber(); int selectProductNumber = MessageLogger.AskSelectProductNumber(); switch (selectProductNumber) { case 1: _product = ShoppingFactory.GetProduct(ProductName.Snack, 100); break; case 2: _product = ShoppingFactory.GetProduct(ProductName.Book, 239); break; case 3: _product = ShoppingFactory.GetProduct(ProductName.Furniture, 299); break; case 4: _product = ShoppingFactory.GetProduct(ProductName.KitchenEquipment, 259); break; case 5: _product = ShoppingFactory.GetProduct(ProductName.Medicine, 200); break; default: break; } int quantity = MessageLogger.AskProductQuantity(_product.Name.ToString()); for (int i = 0; i < quantity; i++) { _shoppingBag.AddProduct(_product); } }