Ejemplo n.º 1
0
        public static void Test()
        {
            // Simple Pizza Order
            SimplePizzaFactory simplePizzaFactory = new SimplePizzaFactory();
            SimplePizzaStore   simplePizzaStore   = new SimplePizzaStore(simplePizzaFactory);
            Pizza simplePizza = simplePizzaStore.orderPizza("cheese");

            Console.WriteLine(simplePizza.ToString());

            // Simple NY Pizza Order
            SimplePizzaFactory nyPizzaFactory = new NYPizzaFactory();
            SimplePizzaStore   nyPizzaStore   = new SimplePizzaStore(nyPizzaFactory);
            Pizza nyPizza = nyPizzaStore.orderPizza("clam");

            Console.WriteLine(nyPizza.ToString());

            // Simple Chicago Pizza Order
            SimplePizzaFactory chicagoPizzaFactory = new ChicagoPizzaFactory();
            SimplePizzaStore   chicagoPizzaStore   = new SimplePizzaStore(chicagoPizzaFactory);
            Pizza chicagoPizza = chicagoPizzaStore.orderPizza("pepperoni");

            Console.WriteLine(chicagoPizza.ToString());
        }
Ejemplo n.º 2
0
 public SimplePizzaStore(SimplePizzaFactory factory)
 {
     this.factory = factory;
 }