Exemplo 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());
        }
Exemplo n.º 2
0
 public override void Prepare()
 {
     Console.WriteLine("Preparing {0}", Name);
     Dough  = pizzaIngredientFactory.CreateDough();
     Sauce  = pizzaIngredientFactory.CreateSauce();
     Cheese = pizzaIngredientFactory.CreateCheese();
     Console.WriteLine("Ingredients: Dough: {0} - Sauce: {1} - Cheese: {2}", Dough.ToString(), Sauce.ToString(), Cheese.ToString());
 }
Exemplo n.º 3
0
 public override void Prepare()
 {
     Console.WriteLine("Preparing {0}", Name);
     Dough   = pizzaIngredientFactory.CreateDough();
     Sauce   = pizzaIngredientFactory.CreateSauce();
     Cheese  = pizzaIngredientFactory.CreateCheese();
     Veggies = pizzaIngredientFactory.CreateVeggies();
     Console.WriteLine("Ingredients: Dough: {0} - Sauce: {1} - Cheese: {2}", Dough.ToString(), Sauce.ToString(),
                       Cheese.ToString());
     Console.Write("Additional Vegtables: ");
     foreach (Veggies vegtable in Veggies)
     {
         Console.Write(vegtable.ToString() + ", ");
     }
     Console.Write("\n");
 }
Exemplo n.º 4
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());
        }
Exemplo n.º 5
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());
        }