예제 #1
0
        static void Main(string[] args)
        {
            PizzaFactory factory = new NYPizzaFactory();

            factory.PreparePizza(PizzaType.Clam);

            factory = new ChicagoPizzaFactory();
            factory.PreparePizza(PizzaType.Salami);
        }
예제 #2
0
        static void Main(string[] args)
        {
            PizzaStore nyStore = new NYPizzaFactory();

            nyStore.OrderPizza("cheese");



            PizzaStore chicagoFactory = new ChicagoPizzaFactory();

            chicagoFactory.OrderPizza("cheese");


            Console.ReadLine();
        }
예제 #3
0
        static void Main(string[] args)
        {
            IPizzaFactory pizzaFactory = new NYPizzaFactory();
            PizzaStore    pizzaStore   = new PizzaStore(pizzaFactory);

            pizzaStore.OrderPizza(PizzaType.Sausage);

            Console.WriteLine("\n");

            pizzaFactory = new ChicagoPizzaFactory();
            pizzaStore   = new PizzaStore(pizzaFactory);
            pizzaStore.OrderPizza(PizzaType.Olives);

            Console.ReadKey();
        }
        public void ChicagoPizzaFactory()
        {
            var factory = new ChicagoPizzaFactory();

            var cheesePizza = factory.createPizza(PizzaType.Cheese);

            Assert.AreEqual(cheesePizza.Price(), _cheesPizzaPrice);

            var pepperoniPizza = factory.createPizza(PizzaType.Pepperoni);

            Assert.IsNull(pepperoniPizza);

            var sausagePizza = factory.createPizza(PizzaType.Sausage);

            Assert.AreEqual(sausagePizza.Price(), _sausagePizzaPrice);
        }
 public ChicagoPizzaStore(ChicagoPizzaFactory pizzaFactory)
 {
     this.pizzaFactory = pizzaFactory;
 }