public Pizza CreatePizza(string type) { Pizza pizza = null; var pizzaType = type.ToLower(); switch (pizzaType) { case "cheese": pizza = new CheesePizza(); break; case "pepperoni": pizza = new PepperoniPizza(); break; case "clam": pizza = new ClamPizza(); break; case "veggie": pizza = new VeggiePizza(); break; } return(pizza); }
protected override Pizza CreatePizza(PizzaType type) { Pizza pizza; switch (type) { case PizzaType.Cheese: pizza = new CheesePizza(_ingredientFactory); pizza.SetName("Chicago Style Cheese Pizza"); break; case PizzaType.Pepperoni: pizza = new PepperoniPizza(_ingredientFactory); pizza.SetName("Chicago Style Pepperoni Pizza"); break; case PizzaType.Clam: pizza = new ClamPizza(_ingredientFactory); pizza.SetName("Chicago Style Clam Pizza"); break; case PizzaType.Veggie: pizza = new VeggiePizza(_ingredientFactory); pizza.SetName("Chicago Style Veggie Pizza"); break; default: return(null); } return(pizza); }
public override Pizza CreatePizza(string item) { Pizza pizza = null; PizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory(); if (item.Equals("cheese")) { pizza = new CheesePizza(ingredientFactory); pizza.Name = "Pizza de Queijo no Estila de Nova York"; } else if (item.Equals("veggie")) { pizza = new VeggiePizza(ingredientFactory); pizza.Name = "Pizza Vegetariana no Estila de Nova York"; } else if (item.Equals("clam")) { pizza = new ClamPizza(ingredientFactory); pizza.Name = "Pizza de Mariscos no Estila de Nova York"; } else if (item.Equals("pepperoni")) { pizza = new PepperoniPizza(ingredientFactory); pizza.Name = "Pizza de Calabresa no Estila de Nova York"; } return(pizza); }
protected override Pizza CreatePizza(string item) { Pizza pizza = null; IPizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory(); if (item.Equals(PizzaIngredientFactoryConstants.CHEESE_PIZZA)) { pizza = new CheesePizza(ingredientFactory); pizza.SetName("New York Style Cheese Pizza"); } else if (item.Equals(PizzaIngredientFactoryConstants.VEGGIE_PIZZA)) { pizza = new VeggiePizza(ingredientFactory); pizza.SetName("New York Style Veggie Pizza"); } else if (item.Equals(PizzaIngredientFactoryConstants.CLAM_PIZZA)) { pizza = new ClamPizza(ingredientFactory); pizza.SetName("New York Style Clam Pizza"); } else if (item.Equals(PizzaIngredientFactoryConstants.PEPPERONI_PIZZA)) { pizza = new PepperoniPizza(ingredientFactory); pizza.SetName("New York Style Pepperoni Pizza"); } return(pizza); }
public IActionResult OrderPepperoniPizza() { PepperoniPizza pepperoniPizza = new PepperoniPizza(); ViewBag.OrderType = "Pepperoni Pizza"; return(RedirectToAction("Index", "Order", new{ orderType = "Pepperoni Pizza", crust = pepperoniPizza.Crust, size = pepperoniPizza.Size, name = pepperoniPizza.Name, price = pepperoniPizza.Price })); }
public override Pizza CreatePizza(string pizzaType) { Pizza pizza = null; IPizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory(); switch (pizzaType) { case "cheese": pizza = new CheesePizza(ingredientFactory); pizza.SetName("New York Style Cheese Pizza"); break; case "veggie": pizza = new VeggiePizza(ingredientFactory); pizza.SetName("New York Style Veggie Pizza"); break; case "clam": pizza = new ClamPizza(ingredientFactory); pizza.SetName("New York Style Clam Pizza"); break; case "pepperoni": pizza = new PepperoniPizza(ingredientFactory); pizza.SetName("New York Style Pepperoni Pizza"); break; } return(pizza); }
protected override PizzaBase CreatePizza(PizzaType type) { PizzaBase pizza = null; IPizzaIngredientFactory factory = new NYPizzaIngredientFactory(); switch (type) { case PizzaType.Cheese: { pizza = new CheesePizza(factory); pizza.SetName("New York Style Cheese Pizza"); break; } case PizzaType.Pepperoni: { pizza = new PepperoniPizza(factory); pizza.SetName("New York Style Pepperoni Pizza"); break; } case PizzaType.Special: { pizza = new CurrentSpecialPizza(factory); pizza.SetName("New York Pizza Special!"); break; } default: throw new ArgumentException("Invalid Pizza type given"); } return(pizza); }
protected override Pizza CreatePizza(string item) { Pizza pizza = null; var ingredientFactory = new ChicagoPizzaIngredientFactory(); switch (item) { case "cheese": pizza = new CheesePizza(ingredientFactory); pizza.Name = "Chicago Style Cheese Pizza"; break; case "pepperoni": pizza = new PepperoniPizza(ingredientFactory); pizza.Name = "Chicago Style Pepperoni Pizza"; break; case "clam": pizza = new ClamPizza(ingredientFactory); pizza.Name = "Chicago Style Clam Pizza"; break; case "veggie": pizza = new VeggiePizza(ingredientFactory); pizza.Name = "Chicago Style Veggie Pizza"; break; } return(pizza); }
protected override Pizza CreatePizza(string type) { Pizza pizza = null; IPizzaIngredientFactory ingredientFactory = new NewYorkIngredientFactory(); if (type.Equals("Cheese")) { pizza = new CheesePizza(ingredientFactory); pizza.SetName("New York Style Cheese"); } else if (type.Equals("Greek")) { pizza = new GreekPizza(ingredientFactory); pizza.SetName("New York Style Greek"); } else if (type.Equals("Pepperoni")) { pizza = new PepperoniPizza(ingredientFactory); pizza.SetName("New York Style Cheese Pepperoni"); } else if (type.Equals("Veggie")) { pizza = new VeggiePizza(ingredientFactory); pizza.SetName("New York Style Veggie"); } else if (type.Equals("Clam")) { pizza = new ClamPizza(ingredientFactory); pizza.SetName("New York Style Clam"); } return(pizza); }
public void GetDescription_LargePepperoniPizzaWithCheese_ReturnsDescription() { var pizza = new PepperoniPizza(new CheesePizza(new LargePizza())); var result = pizza.GetDescription(); Assert.Equal("Large pizza, cheese, pepperoni", result); }
protected override Pizza createPizza(string type) { var ingredientFactory = new NYPizzaIngredientFactory(); Pizza pizza = null; var pizzaType = type.ToLower(); switch (pizzaType) { case "cheese": pizza = new CheesePizza(ingredientFactory); pizza.Name = "New York Style Cheese Pizza"; break; case "pepperoni": pizza = new PepperoniPizza(ingredientFactory); pizza.Name = "New York Style Pepperoni Pizza"; break; case "clam": pizza = new ClamsPizza(ingredientFactory); pizza.Name = "New York Style Clam Pizza"; break; case "veggie": pizza = new VeggiePizza(ingredientFactory); pizza.Name = "New York Style Veggie Pizza"; break; } return(pizza); }
public void GetCost_PepperoniPizzaWithCheese_ReturnsDescription() { var pizza = new PepperoniPizza(new CheesePizza(new SmallPizza())); var result = pizza.GetCost(); Assert.Equal(8.25, result); }
public void GetCost_LargePepperoniPizzaWithCheese_ReturnsCost() { var pizza = new PepperoniPizza(new CheesePizza(new LargePizza())); var result = pizza.GetCost(); Assert.Equal(10.25, result); }
public override ProductPizza CreatePizza(string item) { ProductPizza pizza = null; IPizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory(); if (item.Equals("Cheese")) { pizza = new CheesePizza(ingredientFactory); pizza.Name = "New York Style Cheese Pizza"; Console.WriteLine("Iftekhar odered a " + pizza.Name); pizza.Prepare(); } else if (item.Equals("Veggie")) { pizza = new VeggiePizza(ingredientFactory); pizza.Name = "New York Style Veggie Pizza"; pizza.Prepare(); } else if (item.Equals("Clam")) { pizza = new ClamPizza(ingredientFactory); pizza.Name = "New York Style Clam Pizza"; pizza.Prepare(); } else if (item.Equals("Pepperoni")) { pizza = new PepperoniPizza(ingredientFactory); pizza.Name = "New York Style Pepperoni Pizza"; pizza.Prepare(); } return(pizza); }
public Pizza CreatePizza(PizzaType pizzaType) { Pizza pizza = null; switch (pizzaType) { case PizzaType.Cheese: pizza = new CheesePizza(); break; case PizzaType.Clam: pizza = new ClamPizza(); break; case PizzaType.Pepperoni: pizza = new PepperoniPizza(); break; case PizzaType.Veggie: pizza = new VeggiePizza(); break; } return(pizza); }
public override Pizza CreatePizza(string pizzaType) { Pizza pizza = null; IPizzaIngredientFactory ingredientFactory = new ChicagoPizzaIngredientFactory(); switch (pizzaType) { case "cheese": pizza = new CheesePizza(ingredientFactory); pizza.SetName("Chicago Style Deep Dish Cheese Pizza"); break; case "veggie": pizza = new VeggiePizza(ingredientFactory); pizza.SetName("Chicago Style Deep Dish Veggie Pizza"); break; case "clam": pizza = new ClamPizza(ingredientFactory); pizza.SetName("Chicago Style Deep Dish Clam Pizza"); break; case "pepperoni": pizza = new PepperoniPizza(ingredientFactory); pizza.SetName("Chicago Style Deep Dish Pepperoni Pizza"); break; } return(pizza); }
protected override Pizza CreatePizza(string type) { Pizza pizza = null; PizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory(); switch (type) { case "Cheese": pizza = new CheesePizza(ingredientFactory); pizza.Name = "NY Style Cheese Pizza"; break; case "Pepperoni": pizza = new PepperoniPizza(ingredientFactory); pizza.Name = "NY Style Pepperoni Pizza"; break; case "Clam": pizza = new ClamPizza(ingredientFactory); pizza.Name = "NY Style Clam Pizza"; break; case "Veggie": pizza = new VeggiePizza(ingredientFactory); pizza.Name = "NY Style Veggie Pizza"; break; } return pizza; }
public Pizza OrderPizza(string type) { Pizza pizza; // - - - - - - THIS IS WHAT VARIES. switch (type) { case "cheese": pizza = new CheesePizza(); break; case "pepperoni": pizza = new PepperoniPizza(); break; // Note: This code is not close for modification. // If the pizza offering changes, we have to modify this code. default: Console.WriteLine("Invalid pizza type!"); return(null); } // - - - - - - - - - - - - - - - - - - // THIS IS WHAT WE EXPECT TO STAY THE SAME. pizza.Prepare(); pizza.Bake(); pizza.Cut(); pizza.Box(); return(pizza); }
protected override Pizza CreatePizza(string type) { Pizza pizza = null; switch (type.ToLower()) { case "cheese": pizza = new CheesePizza(_ingredientFactory); pizza.Name = "Chicago Style Cheese Pizza"; break; case "pepperoni": pizza = new PepperoniPizza(_ingredientFactory); pizza.Name = "Chicago Style Pepperoni Pizza"; break; case "clam": pizza = new ClamPizza(_ingredientFactory); pizza.Name = "Chicago Style Clam Pizza"; break; case "veggie": pizza = new VeggiePizza(_ingredientFactory); pizza.Name = "Chicago Style Veggie Pizza"; break; } return(pizza); }
protected override Pizza createPizza(string item) { Pizza pizza = null; // Фабрика производит ингредиенты для всех пицц в Чикаго стиле IPizzaIngredientFactory ingredientFactory = new ChicagoPizzaIngredientFactory(); if (item.Equals("cheese")) { pizza = new CheesePizza(ingredientFactory); pizza.name = "Чикагская с сыром"; } else if (item.Equals("veggie")) { pizza = new VeggiePizza(ingredientFactory); pizza.name = "Чикагская Вегетарианская"; } else if (item.Equals("clam")) { pizza = new ClamPizza(ingredientFactory); pizza.name = "Чикагская с мидиями"; } else if (item.Equals("pepperoni")) { pizza = new PepperoniPizza(ingredientFactory); pizza.name = "Чикагская Пепперони"; } return(pizza); }
public override Pizza CreatePizza(PizzaType pizzaType) { Pizza pizza = null; IPizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory(); if (pizzaType == PizzaType.Cheese) { pizza = new CheesePizza(ingredientFactory); pizza.Name = "New York Cheese Pizza"; } else if (pizzaType == PizzaType.Veggie) { pizza = new VeggiePizza(ingredientFactory); } else if (pizzaType == PizzaType.Pepperoni) { pizza = new PepperoniPizza(ingredientFactory); } else if (pizzaType == PizzaType.Clam) { pizza = new ClamPizza(ingredientFactory); } return(pizza); }
public void Test_PepperoniPizza_Fact() { // arrange Crust pcrust = new Crust("Stuffed", 2.00); Size psize = new Size("Large", 10.50); var sut = new PepperoniPizza(pcrust, psize); var nameExpected = "Pepperoni Pizza"; var sizeExpected = "Large"; var sizePriceExpected = 10.50; var crustExpected = "Stuffed"; var crustPriceExpeced = 2.00; // act var nameActual = sut.Name; var sizeActual = sut.Size.Name; var sizePriceActual = sut.Size.Price; var crustActual = sut.Crust.Name; var crustPriceActual = sut.Crust.Price; // assert Assert.Equal(nameExpected, nameActual); Assert.Equal(sizeExpected, sizeActual); Assert.Equal(sizePriceExpected, sizePriceActual); Assert.Equal(crustExpected, crustActual); Assert.Equal(crustPriceExpeced, crustPriceActual); }
protected override Pizza CreatePizza(string type) { Pizza pizza; var ingredientFactory = new ChicagoPizzaIngredientFactory(); switch (type) { case "cheese": pizza = new CheesePizza(ingredientFactory); pizza.SetName("New York Style Cheese Pizza"); break; case "clam": pizza = new ClamPizza(ingredientFactory); pizza.SetName("New York Style Clam Pizza"); break; case "veggie": pizza = new VeggiePizza(ingredientFactory); pizza.SetName("New York Style Veggie Pizza"); break; case "pepperoni": pizza = new PepperoniPizza(ingredientFactory); pizza.SetName("New York Style Pepperoni Pizza"); break; default: pizza = null; break; } return(pizza); }
protected override Pizza CreatePizza(string type) { Pizza pizza = null; switch (type) { case PizzaType.CHEESE: pizza = new CheesePizza(); pizza.Name = "New York Cheese Pizza"; break; case PizzaType.CLAM: pizza = new ClamPizza(); pizza.Name = "New York Clam Pizza"; break; case PizzaType.PEPPERONI: pizza = new PepperoniPizza(); pizza.Name = "New York Pepperoni Pizza"; break; case PizzaType.VEGGIE: pizza = new VeggiePizza(); pizza.Name = "New York Veggie Pizza"; break; default: throw new ArgumentException(String.Format("Unkonown Pizza Type '{0}'", type)); } return(pizza); }
public override Pizza createPizza(String item) { Pizza pizza = null; PizzaIngredientFactory ingredientFactory = new ChicagoPizzaIngredientFactory(); if (item.Equals("cheese")) { pizza = new CheesePizza(ingredientFactory); pizza.setName("Chicago Style Cheese Pizza"); } else if (item.Equals("veggie")) { pizza = new VeggiePizza(ingredientFactory); pizza.setName("Chicago Style Veggie Pizza"); } else if (item.Equals("clam")) { pizza = new ClamPizza(ingredientFactory); pizza.setName("Chicago Style Clam Pizza"); } else if (item.Equals("pepperoni")) { pizza = new PepperoniPizza(ingredientFactory); pizza.setName("Chicago Style Pepperoni Pizza"); } return(pizza); }
public override Pizza CreatePizza(PizzaTypes pizzaType) { Pizza pizza = null; IngridientFactory ingridientFactory = new NYIngridientFactory(); switch (pizzaType) { case PizzaTypes.Cheese: pizza = new CheesePizza(ingridientFactory); break; case PizzaTypes.Greek: pizza = new GreekPizza(ingridientFactory); break; case PizzaTypes.Papperoni: pizza = new PepperoniPizza(ingridientFactory); break; default: throw new ArgumentException("Wrong PizzaTypes"); } if (pizza != null) { return(pizza); } else { throw new NullReferenceException("Pizza is null"); } }
protected internal override Pizza CreatePizza(string item) { Pizza pizza = null; PizzaIngredientFactory ingredientFactory = new ChicagoPizzaIngredientFactory(); if (item.Equals("cheese")) { pizza = new CheesePizza(ingredientFactory); pizza.Name = "Chicago Style Cheese Pizza"; } else if (item.Equals("veggie")) { pizza = new VeggiePizza(ingredientFactory); pizza.Name = "Chicago Style Veggie Pizza"; } else if (item.Equals("clam")) { pizza = new ClamPizza(ingredientFactory); pizza.Name = "Chicago Style Clam Pizza"; } else if (item.Equals("pepperoni")) { pizza = new PepperoniPizza(ingredientFactory); pizza.Name = "Chicago Style Pepperoni Pizza"; } return(pizza); }
internal override Pizza CreatePizza(PizzaType type) { Pizza pizza; IIngredientFactory IngredientFactory = new NYPizzaIngredientFactory(); switch (type) { case PizzaType.Veggie: pizza = new VeggiePizza(IngredientFactory); pizza.Name = "New York Style Veggie Pizza"; break; case PizzaType.Clam: pizza = new ClamPizza(IngredientFactory); pizza.Name = "New York Style Clam Pizza"; break; case PizzaType.Pepperoni: pizza = new PepperoniPizza(IngredientFactory); pizza.Name = "New York Style Pepperoni Pizza"; break; default: pizza = new CheezePizza(IngredientFactory); pizza.Name = "New York Style Cheese Pizza"; break; } return(pizza); }
/// <summary> /// This subclass handles object instantiation for us in the createPizza() method /// Encapsulates all the knowledge about how to make NY style pizzas /// </summary> public override Pizza createPizza(string type) { Pizza pizza = null; IPizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory(); if (type == "cheese") { pizza = new CheesePizza(ingredientFactory); pizza.setName("NY Style Cheese Pizza."); } else if (type == "veggie") { pizza = new VeggiePizza(ingredientFactory); pizza.setName("NY Style Veggie Pizza."); } else if (type == "clam") { pizza = new ClamPizza(ingredientFactory); pizza.setName("NY Style Clam Pizza."); } else if (type == "pepperoni") { pizza = new PepperoniPizza(ingredientFactory); pizza.setName("NY Style Pepperoni Pizza."); } return(pizza); }
public Pizza CreatePizza(PizzaType pizzaType) { Pizza pizza = null; var pizzaIngredientFactory = new NyPizzaIngredientFactory(); switch (pizzaType) { case PizzaType.Cheese: pizza = new CheezePizza(pizzaIngredientFactory); break; case PizzaType.Pepperoni: pizza = new PepperoniPizza(pizzaIngredientFactory); break; case PizzaType.Clam: pizza = new ClamPizza(pizzaIngredientFactory); break; case PizzaType.Veggie: pizza = new VeggiePizza(pizzaIngredientFactory); break; } return(pizza); }
public override Pizza CreatePizza(string type) { Pizza pizza = null; IPizzaIngredientFactory pizzaIngredientFactory = new NYPizzaIngredientFactory(); if (type == "cheese") { pizza = new CheesePizza(pizzaIngredientFactory); pizza.SetName("New York Style Cheese Pizza"); } else if (type == "clam") { pizza = new ClamPizza(pizzaIngredientFactory); pizza.SetName("New York Style Clam Pizza"); } else if (type == "pepperoni") { pizza = new PepperoniPizza(pizzaIngredientFactory); pizza.SetName("New York Style Pepperoni Pizza"); } else { return(null); } return(pizza); }
public override Pizza CreatePizza(string type) { Pizza pizza = null; if (type.Equals("cheese")) pizza = new ChicagoCheesePizza(); else if (type.Equals("greek")) pizza = new GreekPizza(); else if (type.Equals("pepperoni")) pizza = new PepperoniPizza(); return pizza; }
public Pizza CreatePizza(String type) { Pizza pizza = null; if (type.Equals("cheese")) pizza = new CheesePizza(); if (type.Equals("pepperoni")) pizza = new PepperoniPizza(); // etc. return pizza; }
public IPizza Create(string type) { IPizza pizza = null; if(type == "Cheese") { pizza = new CheesePizza(); } else if(type == "Pepperoni") { pizza = new PepperoniPizza(); } return pizza; }
public Pizza OrderPizza(string type) { Pizza pizza = null; if (type.Equals("cheese")) pizza = new CheesePizza(); else if (type.Equals("greek")) pizza = new GreekPizza(); else if (type.Equals("pepperoni")) pizza = new PepperoniPizza(); pizza.Prepare(); pizza.Bake(); pizza.Cut(); pizza.Box(); return pizza; }
internal Pizza CreatePizza(string type) { Pizza pizza = null; switch (type) { case "Cheese": pizza = new CheesePizza(); break; case "Pepperoni": pizza = new PepperoniPizza(); break; case "Clam": pizza = new ClamPizza(); break; case "Veggie": pizza = new VeggiePizza(); break; } return pizza; }
protected override Pizza CreatePizza(string type) { Pizza pizza = null; IPizzaIngredientFactory ingredientFactory = new ChicagoPizzaIngredientFactory(); switch (type) { case "cheese": pizza = new CheesePizza(ingredientFactory); pizza.Name = "Chicago Style Cheese Pizza"; break; case "clam": pizza = new ClamPizza(ingredientFactory); pizza.Name = "Chicago Style Clam Pizza"; break; case "pepperoni": pizza = new PepperoniPizza(ingredientFactory); pizza.Name = "Chicago Style Pepperoni Pizza"; break; } return pizza; }