Пример #1
0
 static void PrintBeverage(IBeverage b)
 {
     Console.Write(
         "Name: " + b.GetName() +
         " \nCost: " + b.GetCost() +
         "\n"
         );
 }
Пример #2
0
        public override Queue <string> GetName()
        {
            var q   = b.GetName();
            var tmp = base.GetName();

            foreach (var str in tmp)
            {
                q.Enqueue(str);
            }

            return(q);
        }
Пример #3
0
        public override Queue <string> GetName()
        {
            var que = beverage.GetName();
            var tmp = base.GetName();

            foreach (var str in tmp)
            {
                que.Enqueue(str);
            }

            return(que);
        }
        public IBeverage ToBrew()
        {
            IBeverage[] finishedDrinks = new IBeverage[] {
                new Latte(),
                new Americano(),
                new Cappuccino(),
                new Macchiato(),
                new Mocha(),
                new Espresso()
            };

            IBeverage finishedDrink =
                finishedDrinks.FirstOrDefault(f =>
                                              Enumerable.SequenceEqual(f.GetIngredients.OrderBy(i => i), this.Ingredients.OrderBy(i => i))
                                              );

            finishedDrink = (finishedDrink == null) ? new UnknownDrink() : finishedDrink;

            Console.WriteLine("Brew complete.");
            Console.WriteLine(finishedDrink.GetName());

            return(finishedDrink);
        }
Пример #5
0
 public virtual string GetName()
 {
     return(DecoratedBeverage.GetName());
 }
 public string GetName() => $"{beverage.GetName()}, {this.GetType().Name}";