public void TestVersion04()
        {
            PizzaStore nyStore      = new NYPizzaStore();
            PizzaStore chicagoStore = new ChicagoPizzaStore();

            Pizza pizza = nyStore.OrderPizza("cheese");

            Debug.WriteLine("Ethan ordered a " + pizza + "\n");

            pizza = chicagoStore.OrderPizza("cheese");
            Debug.WriteLine("Joel ordered a " + pizza + "\n");

            pizza = nyStore.OrderPizza("clam");
            Debug.WriteLine("Ethan ordered a " + pizza + "\n");

            pizza = chicagoStore.OrderPizza("clam");
            Debug.WriteLine("Joel ordered a " + pizza + "\n");

            pizza = nyStore.OrderPizza("pepperoni");
            Debug.WriteLine("Ethan ordered a " + pizza + "\n");

            pizza = chicagoStore.OrderPizza("pepperoni");
            Debug.WriteLine("Joel ordered a " + pizza + "\n");

            pizza = nyStore.OrderPizza("veggie");
            Debug.WriteLine("Ethan ordered a " + pizza + "\n");

            pizza = chicagoStore.OrderPizza("veggie");
            Debug.WriteLine("Joel ordered a " + pizza + "\n");
        }
Example #2
0
        static void Main(string[] args)
        {
            PizzaStore nyStore      = new NYPizzaStore();
            PizzaStore chicagoStore = new ChicagoPizzaStore();

            Pizza pizza = nyStore.OrderPizza("cheese");

            Console.WriteLine("Ethan ordered a " + pizza._Name + "\n");

            pizza = chicagoStore.OrderPizza("cheese");
            Console.WriteLine("Joel ordered a " + pizza._Name + "\n");

            pizza = nyStore.OrderPizza("clam");
            Console.WriteLine("Ethan ordered a " + pizza._Name + "\n");

            pizza = chicagoStore.OrderPizza("clam");
            Console.WriteLine("Joel ordered a " + pizza._Name + "\n");

            pizza = nyStore.OrderPizza("pepperoni");
            Console.WriteLine("Ethan ordered a " + pizza._Name + "\n");

            pizza = chicagoStore.OrderPizza("pepperoni");
            Console.WriteLine("Joel ordered a " + pizza._Name + "\n");

            pizza = nyStore.OrderPizza("veggie");
            Console.WriteLine("Ethan ordered a " + pizza._Name + "\n");

            pizza = chicagoStore.OrderPizza("veggie");
            Console.WriteLine("Joel ordered a " + pizza._Name + "\n");

            Console.ReadLine();
        }
Example #3
0
        static void Main(string[] args)
        {
            Pizza      pizza;
            PizzaStore nyStore = new NYPizzaStore();

            Console.Clear();

            pizza = nyStore.OrderPizza("cheese");
            System.Console.WriteLine(pizza.ToString());
            System.Console.WriteLine("\r\n");

            pizza = nyStore.OrderPizza("clam");
            System.Console.WriteLine(pizza.ToString());
            System.Console.WriteLine("\r\n");
        }
Example #4
0
        public void TestNYStyleCheesePizza()

        {
            HeadFirstDesignPatterns.Factory.PizzaStore.PizzaStore nyStore =

                new NYPizzaStore();

            Pizza pizza = nyStore.OrderPizza("cheese");

            string pizzaPrepareReturn = "Preparing NY Style Sauce and Cheese Pizza\n" +

                                        "Tossing Thin Crust Dough\n" +

                                        "Adding Martinara Sauce\n" +

                                        "Adding toppings:\n" +

                                        "\tGreated Reggiano Cheese\n";



            Assert.AreEqual(pizzaPrepareReturn, pizza.Prepare());

            Assert.AreEqual("Bake for 25 minutes at 350 \n", pizza.Bake());

            Assert.AreEqual("Cutting the pizza into diagonal slices \n", pizza.Cut());

            Assert.AreEqual("Place pizza in official PizzaStore box \n", pizza.Box());

            Assert.AreEqual("NY Style Sauce and Cheese Pizza", pizza.GetName());
        }
Example #5
0
    private void OnStartButtonClick()
    {
        var factory = new NYPizzaStore();
        var pizza   = factory.OrderPizza(PizzaType.Cheese);

        Log.Print(pizza.GetName());
    }
Example #6
0
        public static void Main(string[] args)
        {
            PizzaStoreWithAF.Stores.PizzaStore nyStore      = new NYPizzaStore();
            PizzaStoreWithAF.Stores.PizzaStore chicagoStore = new ChicagoPizzaStore();

            Pizza pizza;

            try
            {
                pizza = nyStore.OrderPizza("cheese");
                WriteLine("Ethan ordered a {0} pizza\n", pizza.Name);
                WriteLine(pizza);

                pizza = chicagoStore.OrderPizza("clam");
                WriteLine("Joel ordered a {0} pizza\n", pizza.Name);
                WriteLine(pizza);
            }
            catch (Exception x)
            {
                WriteLine("Exception caused by <{0}>", x.Message);
            }

            // Keep console open:
            ReadLine();
        } // Main
Example #7
0
        public void TestNYStyleClamPizza()

        {
            HeadFirstDesignPatterns.AbstractFactory.PizzaStore.PizzaStore nyStore =

                new NYPizzaStore();



            Pizza pizza = nyStore.OrderPizza("clam");



            string pizzaPrepareReturn = "Preparing New York Style Clam Pizza\n" +

                                        "Thin Crust Dough\n" +

                                        "Marinara Sauce\n" +

                                        "Reggiano Cheese\n" +

                                        "Fresh Clams";



            Assert.AreEqual(pizzaPrepareReturn, pizza.Prepare());

            Assert.AreEqual("Bake for 25 minutes at 350 \n", pizza.Bake());

            Assert.AreEqual("Cutting the pizza into diagonal slices \n", pizza.Cut());

            Assert.AreEqual("Place pizza in official PizzaStore box \n", pizza.Box());

            Assert.AreEqual("New York Style Clam Pizza", pizza.Name);
        }
Example #8
0
        static void Main(string[] args)
        {
            NYPizzaFactory factory = new NYPizzaFactory();
            NYPizzaStore   store   = new NYPizzaStore(factory);

            store.OrderPizza("cheese");
        }
Example #9
0
        public void CreateCheesePizza()
        {
            PizzaStore nyPizzaStore = new NYPizzaStore();
            var        pizzaDetails = nyPizzaStore.OrderPizza("cheese");

            Console.WriteLine(pizzaDetails.Name + pizzaDetails.Bake() +
                              pizzaDetails.Box() + pizzaDetails.Cut() + pizzaDetails.Prepare());
        }
Example #10
0
        static void Main(string[] args)
        {
            PizzaStore nyPizzaStore      = new NYPizzaStore();
            PizzaStore chicagoPizzaStore = new ChicagoPizzaStore();

            nyPizzaStore.OrderPizza(PizzaType.Cheese);
            chicagoPizzaStore.OrderPizza(PizzaType.Cheese);
        }
Example #11
0
        private static void FactoryExample2()
        {
            PizzaStore nyStore = new NYPizzaStore();
            Pizza      pizza   = nyStore.OrderPizza(TypeOfPizza.Pepperoni);

            WriteLine($"Pizza {pizza.Name} lista para ser entregada a Rodrigo");
            ReadLine();
        }
Example #12
0
        static void Main(string[] args)
        {
            Console.WriteLine("Pizza Chicago\n");

            ChicagoPizzaStore chicagoPizzaStore = new ChicagoPizzaStore();

            PizzaAbstract cheeseChicago = chicagoPizzaStore.OrderPizza("cheese");
            PizzaAbstract clamChicago   = chicagoPizzaStore.OrderPizza("clam");

            Console.WriteLine("\nPizza New York\n");

            NYPizzaStore nyPizzaStore = new NYPizzaStore();

            PizzaAbstract cheeseNY = nyPizzaStore.OrderPizza("cheese");
            PizzaAbstract clamNY   = nyPizzaStore.OrderPizza("clam");

            Console.ReadKey();
        }
Example #13
0
        public void TestDriver()
        {
            AbstractPizzaStore nyStore      = new NYPizzaStore();
            AbstractPizzaStore chicagoStore = new ChicagoPizzaStore();

            Pizza pizza = nyStore.OrderPizza(PizzaType.Cheese);

            Console.WriteLine($"Ethan ordered a {pizza} ");
        }
Example #14
0
        static void Main(string[] args)
        {
            PizzaStore ps = new NYPizzaStore();

            ps.OrderPizza(PizzaType.CHEESE);


            Console.ReadKey();
        }
Example #15
0
        static void Main(string[] args)
        {
            // Order a New York Chesse Pizza
            PizzaStore nyPizzaStore = new NYPizzaStore();
            var        pizza        = nyPizzaStore.OrderPizza("cheese");

            Console.WriteLine(pizza.name);
            Console.ReadKey();
        }
Example #16
0
 //Abstract Factory Pattern Implementation example
 static void Main(string[] args)
 {
     PizzaStore nyStore      = new NYPizzaStore();
     PizzaStore chicagoStore = new ChicagoPizzaStore();
     var        p            = nyStore.OrderPizza("Cheese");
     var        p1           = chicagoStore.OrderPizza("Veggie");
     var        p2           = chicagoStore.OrderPizza("Clam");
     var        p3           = chicagoStore.OrderPizza("Veggie");
 }
Example #17
0
        private void RunAbstractFactoryExample()
        {
            NYPizzaStore nyPizzaStore = new NYPizzaStore();

            nyPizzaStore.OrderPizza("cheese");

            ChicagoPizzaStore chicagoPizzaStore = new ChicagoPizzaStore();

            chicagoPizzaStore.OrderPizza("cheese");
        }
Example #18
0
        static void Main(string[] args)
        {
            ChicagoPizzaStore chicagoPizzaStore = new ChicagoPizzaStore();

            chicagoPizzaStore.OrderPizza("cheese");

            NYPizzaStore nYPizzaStore = new NYPizzaStore();

            nYPizzaStore.OrderPizza("cheese");
        }
Example #19
0
        static void Main(string[] args)
        {
            Pizza      pizza;
            PizzaStore nyStore      = new NYPizzaStore();
            PizzaStore chicagoStore = new ChicagoPizzaStore();

            Console.Clear();

            pizza = nyStore.OrderPizza("cheese");
            System.Console.WriteLine("\r\n");

            pizza = nyStore.OrderPizza("veggie");
            System.Console.WriteLine("\r\n");

            pizza = chicagoStore.OrderPizza("cheese");
            System.Console.WriteLine("\r\n");

            pizza = chicagoStore.OrderPizza("veggie");
            System.Console.WriteLine("\r\n");
        }
Example #20
0
        static void Main(string[] args)
        {
            PizzaStore nyStore = new NYPizzaStore();

            Pizza pizza = nyStore.OrderPizza("cheese");

            Console.WriteLine($"Ethan ordered a {pizza.GetName()}{Environment.NewLine}");

            pizza = nyStore.OrderPizza("clam");
            Console.WriteLine($"Joel ordered a {pizza.GetName()}{Environment.NewLine}");


            PizzaStore chicagoStore = new ChicagoPizzaStore();

            pizza = chicagoStore.OrderPizza("cheese");
            Console.WriteLine($"Ethan ordered a {pizza.GetName()}{Environment.NewLine}");

            pizza = chicagoStore.OrderPizza("clam");
            Console.WriteLine($"Joel ordered a {pizza.GetName()}{Environment.NewLine}");
        }
Example #21
0
        public static void Start()
        {
            // New York Cheese Pizza
            PizzaStore nyPizzaStore = new NYPizzaStore();

            nyPizzaStore.OrderPizza("cheese");

            PizzaStore chicagoPizzaStore = new ChicagoPizzaStore();

            chicagoPizzaStore.OrderPizza("cheese");
        }
Example #22
0
    private void Main()
    {
        PizzaStore nyStore      = new NYPizzaStore();
        PizzaStore chicagoStore = new ChicagoPizzaStore();

        Pizza pizza = nyStore.OrderPizza("cheese");

        Debug.Log("Jenny ordered a " + pizza.GetName());

        pizza = chicagoStore.OrderPizza("cheese");
        Debug.Log("John ordered a " + pizza.GetName());
    }
Example #23
0
        static void Main(string[] args)
        {
            PizzaStore nyStore      = new NYPizzaStore();
            PizzaStore chicagoStore = new ChicagoPizzaStore();
            Pizza      pizza        = nyStore.OrderPizza(PizzaType.Cheese);

            Console.WriteLine("Ethan ordered a " + pizza.Name + "\n");
            pizza = chicagoStore.OrderPizza(PizzaType.Cheese);
            Console.WriteLine("Joel ordered a " + pizza.Name + "\n");

            Console.ReadKey();
        }
Example #24
0
        private static void RunFactoryPattern()
        {
            Console.WriteLine(@"------------------------------------------------------");
            Console.WriteLine("\tPizza Store Factory Pattern Test");
            Console.WriteLine(@"------------------------------------------------------");
            PizzaStore chicagoPizzaStore = new CHPizzaStore();
            PizzaStore newYorkPizzaStore = new NYPizzaStore();

            chicagoPizzaStore.OrderPizza("Cheese");
            Console.WriteLine("........................................");
            chicagoPizzaStore.OrderPizza("Veggie");
            Console.WriteLine("........................................");
            chicagoPizzaStore.OrderPizza("Pepperoni");
            Console.WriteLine("\n-----------------------------------------\n");
            newYorkPizzaStore.OrderPizza("Cheese");
            Console.WriteLine("........................................");
            newYorkPizzaStore.OrderPizza("Veggie");
            Console.WriteLine("........................................");
            newYorkPizzaStore.OrderPizza("Pepperoni");
            Console.WriteLine(@"------------------------------------------------------");
        }
Example #25
0
        static void Main(string[] args)
        {
            PizzaStore pizzaStore = new NYPizzaStore();
            var        pizza      = pizzaStore.OrderPizza("cheese");

            Console.WriteLine("Name: " + pizza.Name + " Dough: " + pizza.Dough + " Sauce" + pizza.Sauce);

            PizzaStore pizzaStore2 = new ChicagoPizzaStore();
            var        pizza2      = pizzaStore2.OrderPizza("cheese");

            Console.WriteLine("Name: " + pizza2.Name + " Dough: " + pizza2.Dough + " Sauce" + pizza2.Sauce);
        }
        public static void Run()
        {
            PizzaStore nyStore      = new NYPizzaStore();
            PizzaStore chicagoStore = new ChicagoPizzaStore();

            Pizza pizza = nyStore.OrderPizza("cheese");

            Console.WriteLine("Ethan ordered a " + pizza.name + "\n");

            pizza = chicagoStore.OrderPizza("cheese");
            Console.WriteLine("Joel ordered a " + pizza.name + "\n");
        }
Example #27
0
        public void Test()
        {
            PizzaStore nyStore      = new NYPizzaStore();
            PizzaStore chicagoStore = new ChicagoPizzaStore();

            Pizza pizza = nyStore.OrderPizza("cheese");

            Console.WriteLine($"Ethan orderd a {pizza.Name} {Environment.NewLine}");

            pizza = chicagoStore.OrderPizza("cheese");
            Console.WriteLine($"Joel orderd a {pizza.Name} {Environment.NewLine}");
        }
Example #28
0
        static void Main(string[] args)
        {
            PizzaStore nyStore = new NYPizzaStore();
            PizzaStore chicagoStore = new ChicagoPizzaStore();

            Pizza pizza = nyStore.OrderPizza("cheese");
            Console.WriteLine("First pizza {0}", pizza.GetName());

            pizza = chicagoStore.OrderPizza("cheese");
            Console.WriteLine("Second pizza {0}", pizza.GetName());

            Console.ReadKey();
        }
Example #29
0
        static void Main(string[] args)
        {
            PizzaStore store = new NYPizzaStore();

            store.OrderPizza(PizzaType.Cheese);

            Console.WriteLine("\n");

            store = new ChicagoPizzaStore();
            store.OrderPizza(PizzaType.Sausage);

            Console.ReadKey();
        }
Example #30
0
        public static void CreatePizzaTestDrive()
        {
            PizzaStore nyStore      = new NYPizzaStore();
            PizzaStore chicagoStore = new ChicagoStore();

            Pizza pizza = nyStore.OrderPizza("cheese");

            Console.WriteLine($"Ethan ordered a {pizza.Name}");
            Console.WriteLine();

            pizza = chicagoStore.OrderPizza("cheese");
            Console.WriteLine($"Joel ordered a {pizza.Name}");
        }
Example #31
0
        static void Main(string[] args)
        {
            PizzaStore pizzaStore;

            pizzaStore = new NYPizzaStore();
            pizzaStore.OrderPizza(PizzaType.Pepperoni);

            Console.WriteLine("\n");

            pizzaStore = new ChicagoPizzaStore();
            pizzaStore.OrderPizza(PizzaType.Cheese);

            Console.ReadKey();
        }
Example #32
0
 static void Main(string[] args)
 {
     NYPizzaFactory factory = new NYPizzaFactory();
     NYPizzaStore store = new NYPizzaStore(factory);
     store.OrderPizza("cheese");
 }