public void Five_dollars_off_stuffed_crust()
        {
            var pizzaOrderingSystem = new PizzaOrderingSystem(DiscountPolicyDelegates.DiscountAllThePizzas());
            var order = new PizzaOrder()
            {
                Pizzas = new List <Pizza>()
                {
                    new Pizza()
                    {
                        Crust = Crust.Stuffed,
                        Price = 10.00m,
                        Size  = Size.Large
                    }
                }
            };
            var price = pizzaOrderingSystem.ComputePrice(order);

            Assert.Equal(price, 5.00m);
        }
        public void Get_a_pizza_no_discount()
        {
            var pizzaOrderingSystem = new PizzaOrderingSystem(DiscountPolicyDelegates.DiscountAllThePizzas());
            var order = new PizzaOrder()
            {
                Pizzas = new List <Pizza>()
                {
                    new Pizza()
                    {
                        Crust = Crust.Regular,
                        Price = 10.00m,
                        Size  = Size.Large
                    }
                }
            };
            var price = pizzaOrderingSystem.ComputePrice(order);

            Assert.Equal(price, 10.00m);
        }
        public void Five_percent_off_more_than_50_policy()
        {
            var pizzaOrderingSystem = new PizzaOrderingSystem(DiscountPolicyDelegates.DiscountAllThePizzas());
            var order = new PizzaOrder();

            for (int i = 0; i < 6; i++)
            {
                var pizza = new Pizza()
                {
                    Crust = Crust.Regular,
                    Price = 10.00m,
                    Size  = Size.Large
                };
                order.Pizzas.Add(pizza);
            }
            var price = pizzaOrderingSystem.ComputePrice(order);

            Assert.Equal(6, order.Pizzas.Count);
            Assert.Equal(50.00m, price);
        }
        public void Buy_one_get_one_policy()
        {
            var pizzaOrderingSystem = new PizzaOrderingSystem(DiscountPolicyDelegates.DiscountAllThePizzas());
            var order = new PizzaOrder();

            for (int i = 0; i < 2; i++)
            {
                var pizza = new Pizza()
                {
                    Crust = Crust.Regular,
                    Price = 10.00m,
                    Size  = Size.Large
                };
                order.Pizzas.Add(pizza);
            }
            var price = pizzaOrderingSystem.ComputePrice(order);

            Assert.Equal(2, order.Pizzas.Count);
            Assert.Equal(10.00m, price);
        }
        public void Best_discount_for_big_order()
        {
            var pizzaOrderingSystem = new PizzaOrderingSystem(
                DiscountPolicyDelegates.DiscountAllThePizzas());
            var order = new PizzaOrder();

            // Buy one get one
            for (int i = 0; i < 2; i++)
            {
                var pizza = new Pizza()
                {
                    Crust = Crust.Regular,
                    Price = 10.00m,
                    Size  = Size.Large
                };
                order.Pizzas.Add(pizza);
            }
            // Over 50 5% off
            for (int i = 0; i < 6; i++)
            {
                var pizza = new Pizza()
                {
                    Crust = Crust.Regular,
                    Price = 10.00m,
                    Size  = Size.Large
                };
                order.Pizzas.Add(pizza);
            }
            // Stuffed crust
            var stuffedCrust = new Pizza()
            {
                Crust = Crust.Stuffed,
                Price = 10.00m,
                Size  = Size.Large
            };

            order.Pizzas.Add(stuffedCrust);
            var price = pizzaOrderingSystem.ComputePrice(order);

            Assert.Equal(80.00m, price);
        }