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()); }
public SimplePizzaStore(SimplePizzaFactory factory) { this.factory = factory; }