Beispiel #1
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);
        }
Beispiel #2
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());
        }
Beispiel #3
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());
        }
Beispiel #4
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);
        }
Beispiel #5
0
 public void OrderPizza(PizzaType T)
 {
     pizza = Create(T);
     pizza.Prepare();
     pizza.Bake();
     pizza.Cut();
     pizza.Box();
 }
Beispiel #6
0
        public void OrderPizza(string pizzaName)
        {
            Pizza pizza = CreatePizza(pizzaName);

            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();
        }
Beispiel #7
0
        public void OrderPizza(PizzaType type)
        {
            Pizza pizza = CreatePizza(type);

            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();
        }
Beispiel #8
0
 public Pizza OrderPizza(string type)
 {
     Pizza pizza = CreatePizza(type);
     pizza.Prepare();
     pizza.Bake();
     pizza.Cut();
     pizza.Box();
     return pizza;
 }
Beispiel #9
0
        public Pizza OrderPizza(PizzaType pizzaType)
        {
            Pizza pizza = CreatePizza(pizzaType);

            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();
            return(pizza);
        }
        public Pizza PreparePizza(PizzaType type)
        {
            _pizza = CreatePizza(type);
            _pizza.Prepare();
            _pizza.Bake();
            _pizza.Cut();
            _pizza.Box();

            return(_pizza);
        }
Beispiel #11
0
        internal Pizza OrderPizza(PizzaType type)
        {
            Pizza pizza = CreatePizza(type);

            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();
            return(pizza);
        }
        public Pizza OrderPizza(TypeOfPizza type)
        {
            Pizza pizza = CreatePizza(type);

            pizza.Prepare();
            pizza.Cut();
            pizza.Box();

            return(pizza);
        }
Beispiel #13
0
        public Pizza OrderPizza(string type)
        {
            Pizza pizzaBase = CreatePizza(type);

            pizzaBase.Prepare();
            pizzaBase.Bake();
            pizzaBase.Cut();
            pizzaBase.Box();

            return(pizzaBase);
        }
Beispiel #14
0
        public Pizza OrderPizza(string item)
        {
            Pizza pizza = CreatePizza(item);

            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();

            return(pizza);
        }
Beispiel #15
0
        public Pizza OrderPizza(string type, Enum size)
        {
            Pizza pizza = CreatePizza(type, size);

            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();

            return(pizza);
        }
Beispiel #16
0
        public Pizza OrderPizza(string pizzaType)
        {
            Pizza pizza = this._factory.GetPizza(pizzaType);

            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();
            pizza.Description();
            return(pizza);
        }
Beispiel #17
0
    public Pizza orderPizza(PizzaType type)
    {
        Pizza pizza = createPizza(type);

        pizza.Prepare();
        pizza.Bake();
        pizza.Cut();
        pizza.Box();

        return(pizza);
    }
        public Pizza OrderPizza(string type)
        {
            Pizza pizza = CreatePizza(type);

            Console.WriteLine("--- Making a " + pizza.Name + " ---");
            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();
            return(pizza);
        }
Beispiel #19
0
        public Pizza OrderPizza(string type)
        {
            Pizza pizza = _simplePizzaFactory.CreatePizza(type);

            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();

            return(pizza);
        }
Beispiel #20
0
        public Pizza OrderPizza(string pizzaType = " ")
        {
            Pizza pizza = GetPizza(pizzaType);

            pizza.Prepper();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();
            pizza.Description();
            return(pizza);
        }
Beispiel #21
0
        /// <summary>
        /// The order pizza.
        /// </summary>
        /// <param name="pizzaType">
        /// The pizza type.
        /// </param>
        /// <returns>
        /// The <see cref="Pizza"/>.
        /// </returns>
        public Pizza OrderPizza(string pizzaType)
        {
            Pizza pizza = this.factory.CreatePizza(pizzaType);

            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();

            return(pizza);
        }
Beispiel #22
0
    public Pizza OrderPizza(string type)
    {
        Pizza pizza = pizzaCreation(type);

        pizza.Prepare();
        pizza.Bake();
        pizza.Cut();
        pizza.Box();

        return(pizza);
    }
Beispiel #23
0
        public Pizza OrderPizza(string pizzaType)
        {
            Pizza pizza = MakePizza(pizzaType);

            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();

            return(pizza);
        }
Beispiel #24
0
        public Pizza OrderPizza(string type)
        {
            Pizza pizza = factory.CreatePizza(type);

            if (pizza != null)
            {
                pizza.Prepare();
                pizza.Bake();
                pizza.Cut();
                pizza.Box();
            }
            return(pizza);
        }
Beispiel #25
0
        public override IPizza MakePizza(string name)
        {
            var pizza = new Pizza();

            switch (name)
            {
            case "Pepperoni":
                pizza.Build(name, "tomato", "cheese, basil, pepperoni");
                pizza.Bake(350, 18);
                pizza.Slice(12);
                pizza.Box();
                break;

            default:
                pizza.Build(name, "tomato", "cheese, basil");
                pizza.Bake(350, 18);
                pizza.Slice(12);
                pizza.Box();
                break;
            }

            return(pizza);
        }
Beispiel #26
0
        public Pizza OrderPizza(string type)
        {
            Pizza pizza = CreatePizza(type);

            if (pizza == null)
            {
                throw new Exception("Unknown pizza ordered.");
            }

            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();
            return(pizza);
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Console.WriteLine("What Piza do you you want");

            string answer = Console.ReadLine();

            SimplePizzaFactory spf = new SimplePizzaFactory();

            Pizza pizza = spf.CreatePizza("Cheese");

            pizza.Prepare();
            pizza.Bake();
            pizza.Box();

            Zeeks zeeks = new Zeeks();

            zeeks.OrderPizza("Cheese");
        }
Beispiel #28
0
        public void OrderPizza(string pizzaName)
        {
            /* The code commented below is tightly coupled and breaks the OCP */

            //if (pizzaName == "cheese")
            //{
            //    _pizaa = new CheesePizza();
            //}
            //if (pizzaName == "peppypaneer")
            //{
            //    _pizaa = new PeppypaneerPizza();
            //}
            //if (pizzaName == "farmhouse")
            //{
            //    _pizaa = new FarmhousePizza();
            //}

            Pizza pizza = _simplePizzaFactory.CreatePizza(pizzaName);

            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();
        }