static void Main(string[] args) { PizzaChef pizzaChef = new PizzaChef(); PastaChef pastaChef = new PastaChef(); SeaFoodChef seaFoodChef = new SeaFoodChef(); pizzaChef.SetNextHandler(pastaChef).SetNextHandler(seaFoodChef); foreach (string request in new string[] { "Pizza", "Pasta", "Sea Food", "Salad" }) { pizzaChef.HandleRequest(request); } Console.ReadLine(); }
public override void Execute() { var chef = new PizzaChef(); chef.SetPizzaRecipe(new PepperoniPizzaRecipe()); chef.ConstructPizza(); Pizza pepperoniPizza = chef.ServePizza(); Assert.Equal(Sauce.Tomato, pepperoniPizza.Sauce); Assert.Equal(Topping.Pepperoni | Topping.Cheese, pepperoniPizza.Toppings); chef.SetPizzaRecipe(new SpecialPizzaRecipe()); chef.ConstructPizza(); Pizza specialPizza = chef.ServePizza(); Assert.Equal(Sauce.Spicy, specialPizza.Sauce); Assert.Equal(Topping.Bacon | Topping.Cheese | Topping.Onion | Topping.Sausage, specialPizza.Toppings); }
public Pizza() { chef = new PizzaChef(); }