Beispiel #1
0
 public AbstractPizza MakePizza(string[] adds)
 {
     AbstractPizza pizza = new PlainPizza();
     if (adds.Length < 0)
     {
         return pizza;
     }
     foreach (var add in adds)
     {
         pizza = AddIngredients(add, pizza);
     }
     return pizza;
 }
Beispiel #2
0
        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();
        }