Ejemplo n.º 1
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.AppendLine($"---- {Name} ----");

            if (Dough != null)
            {
                sb.AppendLine(Dough.ToString());
            }
            if (Sauce != null)
            {
                sb.AppendLine(Sauce.ToString());
            }
            if (Cheese != null)
            {
                sb.AppendLine(Cheese.ToString());
            }
            if (Veggies != null)
            {
                sb.AppendLine(string.Join(",", Veggies));
            }
            if (Clam != null)
            {
                sb.AppendLine(Clam.ToString());
            }
            if (Pepperoni != null)
            {
                sb.AppendLine(Pepperoni.ToString());
            }

            return(sb.ToString());
        }
Ejemplo n.º 2
0
        public override string ToString()
        {
            var result = new StringBuilder();

            result.AppendLine("---- " + Name + " ----");
            if (Dough != null)
            {
                result.AppendLine(Dough.ToString());
            }
            if (Sauce != null)
            {
                result.AppendLine(Sauce.ToString());
            }
            if (Cheese != null)
            {
                result.AppendLine(Cheese.ToString());
            }
            if (Veggies != null)
            {
                bool isFirst = true;
                foreach (var veggy in Veggies)
                {
                    if (isFirst)
                    {
                        result.Append(veggy.ToString());
                        isFirst = false;
                    }
                    else
                    {
                        result.Append(", ");
                        result.Append(veggy.ToString());
                    }
                }
                result.AppendLine();
            }
            if (Pepperoni != null)
            {
                result.AppendLine(Pepperoni.ToString());
            }
            if (Clams != null)
            {
                result.AppendLine(Clams.ToString());
            }
            return(result.ToString());
        }
Ejemplo n.º 3
0
        public override string ToString()
        {
            var result = new StringBuilder();

            result.AppendLine("---- " + Name + " ----");
            if (Dough != null)
            {
                result.AppendLine(Dough.ToString());
            }
            if (Sauce != null)
            {
                result.AppendLine(Sauce.ToString());
            }
            if (Cheese != null)
            {
                result.AppendLine(Cheese.ToString());
            }
            if (Veggies != null)
            {
                for (int i = 0; i < Veggies.Length; i++)
                {
                    result.Append(Veggies[i].ToString());
                    if (i < Veggies.Length - 1)
                    {
                        result.Append(", ");
                    }
                }
                result.Append("\n");
            }
            if (Clam != null)
            {
                result.AppendLine(Clam.ToString());
            }
            if (Pepperoni != null)
            {
                result.AppendLine(Pepperoni.ToString());
            }

            return(result.ToString());
        }
Ejemplo n.º 4
0
 public override void Prepare()
 {
     Console.WriteLine("Preparing {0}", Name);
     Dough     = pizzaIngredientFactory.CreateDough();
     Sauce     = pizzaIngredientFactory.CreateSauce();
     Cheese    = pizzaIngredientFactory.CreateCheese();
     Pepperoni = pizzaIngredientFactory.CreatePepperoni();
     Console.WriteLine("Ingredients: Dough: {0} - Sauce: {1} - Cheese: {2} - Pepperoni: {3}", Dough.ToString(), Sauce.ToString(), Cheese.ToString(), Pepperoni.ToString());
 }