static void Main(string[] args) { /*STEP 1*/ /*AbstractPizza pp = new PlainPizza(); * pp = new HamDecorator(pp); * pp = new BaconDecorator(pp); * pp = new PepperoniDecorator(pp); * Console.WriteLine(pp);*/ /*STEP 2 */ //PizzaFactory pf = new PizzaFactory(); //Console.WriteLine(pf.MakePizza(new []{"bacon","bacon","bacon"})); /*STEP 3*/ //PizzaOven oven = new PizzaOven(); //PizzaMan man = new PizzaMan(oven); //man.TakeOrder(new []{"bacon","ham"}); //Console.ReadKey(); /*STEP 4*/ PizzaOven oven = new PizzaOven(); PizzaMan man = new PizzaMan(oven); man.TakeOrder(new [] { "ham", "bacon", "bacon" }, "beer", 7.50); Console.ReadKey(); }
public PizzaMan(PizzaOven pizzaOven) { PizzaOven = pizzaOven; PizzaOven.AddObserver(this); Factory = new PizzaFactory(); PriceStrategy = TimeOfDay.Lunch; EveningPriceStrategy = new EveningPriceStrategy(); LunchPriceStrategy = new LunchPriceStrategy(); NightPriceStrategy = new NightPriceStrategy(); }
static void Main(string[] args) { AbstractPizza pp = new PlainPizza(); pp = new HamDecorator(pp); pp = new BaconDecorator(pp); pp = new PepperoniDecorator(pp); Console.WriteLine(pp); PizzaFactory pf = new PizzaFactory(); Console.WriteLine(pf.MakePizza(new[] { "Pepperoni", "Bacon", "Ham" })); PizzaOven oven = new PizzaOven(); PizzaMan newMan = new PizzaMan(oven); Console.WriteLine(); newMan.TakeOrder(new[] { "Pepperoni", "Bacon" }); newMan.TakeOrder(new[] { "Pepperoni", "Bacon" }, "Cola", 21.0); Console.ReadKey(); }