Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }