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
 //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 #4
0
        public void ChicagoPizzaStoreTest()
        {
            PizzaStore store = new ChicagoPizzaStore();

            store.OrderPizza(PizzaType.Cheese);

            Assert.AreEqual(_verifyResult,
                            "Preparing: Chicago Style Cheese PizzaBake for 25 minutes at 350Cutting the pizza into square slicesPlace pizza in official PizzaStore box");

            _verifyResult = String.Empty;
            store.OrderPizza(PizzaType.Clam);

            Assert.AreEqual(_verifyResult,
                            "Preparing: Chicago Style Clam PizzaBake for 25 minutes at 350Cutting the pizza into square slicesPlace pizza in official PizzaStore box");
        }
Example #5
0
        public void TestChicagoStylePepperoniPizza()

        {
            HeadFirstDesignPatterns.AbstractFactory.PizzaStore.PizzaStore chicagoStore =

                new ChicagoPizzaStore();



            Pizza pizza = chicagoStore.OrderPizza("pepperoni");



            string pizzaPrepareReturn = "Preparing Chicago Style Pepperoni Pizza\n" +

                                        "Thick Crust Dough\n" +

                                        "Plum Tomato Sauce\n" +

                                        "Mozzerella Cheese\n" +

                                        "Sliced Pepperoni";



            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("Chicago Style Pepperoni Pizza", pizza.Name);
        }
Example #6
0
        public void TestChicagoStyleCheesePizza()

        {
            HeadFirstDesignPatterns.Factory.PizzaStore.PizzaStore chicagoStore =

                new ChicagoPizzaStore();

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



            string pizzaPrepareReturn = "Preparing Chicago Style Deep Dish Cheese Pizza\n" +

                                        "Tossing Extra Thick Crust Dough\n" +

                                        "Adding Plum Tomato Sauce\n" +

                                        "Adding toppings:\n" +

                                        "\tShredded Mozzarella Cheese\n";



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

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

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

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

            Assert.AreEqual("Chicago Style Deep Dish Cheese Pizza", pizza.GetName());
        }
Example #7
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
        public void CanCreatePizza_ChicagoStyleCheese()
        {
            var nyPizzaStore = new ChicagoPizzaStore();

            nyPizzaStore.OrderPizza(PizzaType.Cheese);
            new ChicagoStyleCheesePizza().Cut();
        }
Example #9
0
        static void Main(string[] args)
        {
            PizzaStore nyPizzaStore      = new NYPizzaStore();
            PizzaStore chicagoPizzaStore = new ChicagoPizzaStore();

            nyPizzaStore.OrderPizza(PizzaType.Cheese);
            chicagoPizzaStore.OrderPizza(PizzaType.Cheese);
        }
        public static void Start()
        {
            PizzaStore pizzaStore = new NYPizzaStyleStore();

            pizzaStore.OrderPizza(PizzaType.Cheese);
            "----------------------".P();
            pizzaStore = new ChicagoPizzaStore();
            pizzaStore.OrderPizza(PizzaType.Cheese);
        }
Example #11
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 #12
0
        static void Main(string[] args)
        {
            ChicagoPizzaStore chicagoPizzaStore = new ChicagoPizzaStore();

            chicagoPizzaStore.OrderPizza("cheese");

            NYPizzaStore nYPizzaStore = new NYPizzaStore();

            nYPizzaStore.OrderPizza("cheese");
        }
Example #13
0
        private void RunAbstractFactoryExample()
        {
            NYPizzaStore nyPizzaStore = new NYPizzaStore();

            nyPizzaStore.OrderPizza("cheese");

            ChicagoPizzaStore chicagoPizzaStore = new ChicagoPizzaStore();

            chicagoPizzaStore.OrderPizza("cheese");
        }
Example #14
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 #15
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 #16
0
        public static void Start()
        {
            // New York Cheese Pizza
            PizzaStore nyPizzaStore = new NYPizzaStore();

            nyPizzaStore.OrderPizza("cheese");

            PizzaStore chicagoPizzaStore = new ChicagoPizzaStore();

            chicagoPizzaStore.OrderPizza("cheese");
        }
Example #17
0
        public void AbstractFactory_CheeseProductsCreated()
        {
            PizzaStore chiStore = new ChicagoPizzaStore();
            Pizza      chiPizza = chiStore.OrderPizza("Cheese");

            PizzaStore nyStore = new NewYorkPizzaStore();
            Pizza      nyPizza = nyStore.OrderPizza("Cheese");

            Assert.AreEqual("Chicago Cheese Pizza", chiPizza.Name);
            Assert.AreEqual("New York Cheese Pizza", nyPizza.Name);
        }
Example #18
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 #19
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 #20
0
        public static void Sample()
        {
            var newYorkPizzaStore = new NewYorkPizzaStore();

            newYorkPizzaStore.OrderPizza("cheese");

            Console.WriteLine("-----------------------------------------------------------");

            var chicagoYorkPizzaStore = new ChicagoPizzaStore();

            chicagoYorkPizzaStore.OrderPizza("cheese");
        }
        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 #22
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);
        }
Example #23
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 #24
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 #25
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 #26
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 #27
0
        static void Main(string[] args)
        {
            var newYorkPizzaStore = new NewYorkPizzaStore();

            newYorkPizzaStore.OrderPizza("cheese");

            Console.WriteLine("-----------------------------------------------------------");

            var chicagoYorkPizzaStore = new ChicagoPizzaStore();

            chicagoYorkPizzaStore.OrderPizza("cheese");

            Console.ReadKey();
        }
Example #28
0
        public void PizzaStoreFactories_CreateProducts()
        {
            PizzaStore nyStore      = new NewYorkPizzaStore();
            Pizza      nyPizza      = nyStore.OrderPizza("Cheese");
            PizzaStore chicagoStore = new ChicagoPizzaStore();
            Pizza      chiPizza     = chicagoStore.OrderPizza("Cheese");

            Assert.AreEqual("Thin Crust Dough", nyPizza.Dough);
            Assert.AreEqual("New York Style Cheese Pizza", nyPizza.Name);
            Assert.AreEqual("Marinara Sauce", nyPizza.Sauce);
            Assert.AreEqual("Thick Crust Dough", chiPizza.Dough);
            Assert.AreEqual("Chicago Style Cheese Pizza", chiPizza.Name);
            Assert.AreEqual("Plum Tomato Sauce", chiPizza.Sauce);
        }
        static void Main(string[] args)
        {
            // implement prepare methods in pizzas, f.e. in NYStyleVeggiePizza then run
            PizzaStore nyStore      = new NYPizzaStore();
            PizzaStore chicagoStore = new ChicagoPizzaStore();

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

            Console.WriteLine($"You ordered a {pizza.Name}\n");

            pizza = chicagoStore.OrderPizza("cheese");
            Console.WriteLine($"Another ordered pizza is {pizza.Name}\n");

            Console.ReadKey();
        }
Example #30
0
        static void Main(/*string[] args*/)
        {
            //Two Pizza Store, more can be opened without changing the base classes.
            PizzaStore nyStore = new NYPizzaStore();
            PizzaStore chStore = new ChicagoPizzaStore();

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

            Console.WriteLine("Ethan ordered a " + pizza.GetName());

            Console.WriteLine();

            pizza = chStore.OrderPizza("clam");
            Console.WriteLine("Joe ordered a " + pizza.GetName());
        }
        static void Main(string[] args)
        {
            //var factory = new SimplePizzaFactory();
            //var store = new SimplePizzaStore(factory);

            //var pizza = store.OrderPizza("cheese");

            Console.Write(PizzaAscii.Pizza);

            var newYorkStore = new NewYorkPizzaStore();
            var chicagoStore = new ChicagoPizzaStore();

            newYorkStore.OrderPizza("cheese");
            chicagoStore.OrderPizza("pepperoni");
        }