Пример #1
0
        public void ValidateCartTotalAfterRemovingItemsFromCart()
        {
            List <Product> itemsToAdd = new List <Product>()
            {
                new Product("Salt & Chilli Smoked Chicken", ProductType.Starter),
                new Product("Spring Pancake Roll", ProductType.Starter),
                new Product("Roast Barbecued Pork Spare Ribs", ProductType.Starter),
                new Product("Capital Spare Ribs of Pork", ProductType.Starter),
                new Product("King Prawn Chop Suey", ProductType.MainCourse),
                new Product("Sweet & Sour Chicken", ProductType.MainCourse),
                new Product("Chicken Chow Mein", ProductType.MainCourse),
                new Product("Curried King Prawn", ProductType.MainCourse)
            };

            RestaurantCart cart = new RestaurantCart();

            cart.Add(itemsToAdd);

            List <Product> itemsToRemove = new List <Product>()
            {
                new Product("Roast Barbecued Pork Spare Ribs", ProductType.Starter),
                new Product("Capital Spare Ribs of Pork", ProductType.Starter),
                new Product("King Prawn Chop Suey", ProductType.MainCourse),
                new Product("Sweet & Sour Chicken", ProductType.MainCourse)
            };

            cart.Delete(itemsToRemove);
            var updatedcartTotal = cart.CartTotal();

            Assert.AreEqual(22.8, updatedcartTotal);
        }
Пример #2
0
        public void RemoveItemsFromEmptyCart()
        {
            List <Product> products = new List <Product>
            {
                new Product("Salt & Chilli Smoked Chicken", ProductType.Starter),
                new Product("Spring Pancake Roll", ProductType.Starter)
            };
            RestaurantCart cart = new RestaurantCart();

            cart.Delete(products);
            var cartTotal = cart.CartTotal();

            Assert.AreEqual(0, cartTotal);
        }