Esempio n. 1
0
        public void ValidateCartItemCountAfterRemovingItemsFromCartByMenuItemType()
        {
            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.GetItemsCountBy(ProductType.Starter);

            Assert.AreEqual(2, updatedcartTotal);
        }
Esempio n. 2
0
        public void ValidateCartItemCountOfAddedItemsByMenuItemType()
        {
            List <Product> products = 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(products);
            var cartTotal = cart.GetItemsCountBy(ProductType.Starter);

            Assert.AreEqual(4, cartTotal);
        }
Esempio n. 3
0
        public void ValidateCartItemCountAfterUpdatingCartItemsByMenuItemType()
        {
            List <Product> itemsToAdd = new List <Product>()
            {
                new Product("Salt & Chilli Smoked Chicken", ProductType.Starter),
                new Product("Spring Pancake Roll", ProductType.Starter)
            };

            RestaurantCart cart = new RestaurantCart();

            cart.Add(itemsToAdd);
            var cartTotal = cart.CartTotal();

            List <Product> itemsToUpdate = new List <Product>();

            itemsToUpdate.Add(new Product("Salt & Chilli Smoked Chicken", ProductType.MainCourse));

            cart.Update(itemsToUpdate);
            var cartTotal2 = cart.GetItemsCountBy(ProductType.MainCourse);

            Assert.AreEqual(1, cartTotal2);
        }