コード例 #1
0
        public override string ToString()
        {
            StringBuilder result = new StringBuilder();

            result.AppendLine($"---- {Name} ----");
            if (Dough != null)
            {
                result.AppendLine(Dough.Description());
            }
            if (Sauce != null)
            {
                result.AppendLine(Sauce.Description());
            }
            if (Cheese != null)
            {
                result.AppendLine(Cheese.Description());
            }
            if (Veggies != null)
            {
                result.AppendLine("Veggies : ");
                foreach (var veggie in Veggies)
                {
                    result.AppendLine(veggie.Description().PadLeft(40));
                }
            }
            if (Clam != null)
            {
                result.AppendLine(Clam.Description());
            }
            if (Pepperoni != null)
            {
                result.AppendLine(Pepperoni.Description());
            }
            return(result.ToString());
        }
コード例 #2
0
 public override void Prepare()
 {
     Console.WriteLine($"Preparing { Name}");
     Dough = _pizzaIngredientFactory.CreateDough();
     Dough.Dough();
     Sauce = _pizzaIngredientFactory.CreateSauce();
     Sauce.Sauce();
 }