static void Main(string[] args) { // Here I am declaring my Pizza Factory and the Store which I will use to place order. PizzaFactory myPizzaFactory = new PizzaFactory(); PizzaStore myPizzaStore = new PizzaStore(myPizzaFactory); Console.WriteLine("Welcome to my Pizza Store!"); Console.WriteLine("Please enter your pizza type from"); Console.WriteLine("(Cheese)(Veggie)(Clam)(Pepperoni)"); var pizzaType = Console.ReadLine(); // Here I have used my Store to place my order and asked it to create pizza based on its type. var pizza = myPizzaStore.OrderPizza(pizzaType); // Here I am returning my pizza that I have received from the factory. if (pizza != null) { Console.WriteLine("Thank for Ordering " + pizza.GetType() + " please collect your order from front desk in 15 min"); } else { Console.WriteLine("We are sorry to serve you today. Facing issue with the system."); } }
public void should_get_greek_pizza_given_order_greek_pizza() { var pizzaStore = new PizzaStore(); var pizza = pizzaStore.OrderPizza("greek"); Assert.Equal(typeof(GreekPizza), pizza.GetType()); }
public void should_get_cheese_pizza_given_order_cheese_pizza() { var pizzaStore = new PizzaStore(); var pizza = pizzaStore.OrderPizza("cheese"); Assert.Equal(typeof(CheesePizza), pizza.GetType()); }
static void Main(string[] args) { PizzaStore store = new PizzaStore(new PizzaFactory()); Pizza myPizza = store.OrderPizza("Clam"); }
static void Main(string[] args) { PizzaStore pizzaStore = new PizzaStore(new SimplePizzaFactory()); pizzaStore.OrderPizza("Cheese"); Console.ReadLine(); }