public void SimpleStoreUT_TestCheesyPizza() { SimplePizzaStore pizzaStore = new SimplePizzaStore(); Assert.AreEqual("Preparing Cheesy Pizza\n" + "Baking Cheesy Pizza\n" + "Cutting Cheesy Pizza\n" + "Boxing Cheesy Pizza\n", pizzaStore.OrderPizza("Cheese")); }
public static void Factory() { // simple factory var simpleFactory = new SimplePizzaFactory(); var simpleStore = new SimplePizzaStore(simpleFactory); var pizza = simpleStore.OrderPizza("cheese"); pizza = simpleStore.OrderPizza("pepperoni"); // factory method pizza = new CheesePizzaFactory().OrderPizza(); pizza = new PepperoniPizzaFactory().OrderPizza(); }
static void Main(string[] args) { PizzaStore NYStore = new NYPizzaStore(); Pizza pizza = NYStore.OrderPizza("Cheese"); Console.WriteLine("Ethan order a " + pizza.Name + "\n"); Console.WriteLine("---------------------------------------------------\n"); PizzaStore ChicargoStore = new ChicagoPizzaStore(); pizza = ChicargoStore.OrderPizza("Clam"); Console.WriteLine("Joel ordered a " + pizza.Name + "\n"); Console.WriteLine("-----------------------------------\n"); //SimplePizzaFactory simpleFactory = new SimplePizzaFactory(); //SimplePizzaStore simpleStore = new SimplePizzaStore(simpleFactory); //pizza = simpleStore.OrderPizza("Cheese"); //Console.WriteLine("Martin ordered a " + pizza.Name + "\n"); Console.WriteLine("SimpleFactory Use static\n"); SimplePizzaStore simpleStore = new SimplePizzaStore(); pizza = simpleStore.OrderPizza("Cheese"); Console.WriteLine("Martin ordered a " + pizza.Name + "\n"); Console.WriteLine("------------------------------------\n"); Console.WriteLine("Abstract Factory with Ingredient \n"); PizzaStoreFromAF nyStore = new NYPizzaStoreFromAF(); PizzaFromAF pizzaAF = nyStore.OrderPizza("Cheese"); Console.WriteLine("Amy ordered a " + pizzaAF.Name + " \n"); }
public void Setup() { _sut = new SimplePizzaStore(new SimplePizzaFactory()); }