Esempio n. 1
0
        public decimal ComputePrice(PizzaOrder order)
        {
            decimal nonDiscounted   = order.Pizzas.Sum(p => p.Price);
            decimal discountedValue = _discountPolicy(order);

            return(nonDiscounted - discountedValue);
        }
Esempio n. 2
0
        public static decimal BuyOneGetOneFree(PizzaOrder order)
        {
            var pizzas = order.Pizzas;

            if (pizzas.Count < 2)
            {
                return(0m);
            }
            return(pizzas.Min(p => p.Price));
        }
Esempio n. 3
0
 public static decimal FiveDollarsOffStuffedCrust(PizzaOrder order)
 {
     return(order.Pizzas.Sum(p => p.Crust == Crust.Stuffed ? 5m : 0m));
 }
Esempio n. 4
0
        public static decimal FivePercentOffMoreThanFiftyDollars(PizzaOrder order)
        {
            decimal nonDiscounted = order.Pizzas.Sum(p => p.Price);

            return(nonDiscounted >= 50 ? nonDiscounted * 0.05m : 0M);
        }