Ejemplo n.º 1
0
 public virtual void ServeCoffee(CoffeeType type, ISmartCoffeeCup cup)
 {
     try
     {
         ServeCoffeeInternal(type, cup);
     }
     catch (Exception ex)
     {
         Audit("Ërror while serving coffee");
         throw;
     }
 }
        protected override void ServeCoffeeInternal(CoffeeType type, ISmartCoffeeCup cup)
        {
            if (!_isSwitchedOn)
            {
                Console.WriteLine("Coffee machine is off.");
                return;
            }
            _orderNumber += 1;
            var coffee = PrepareCoffee(type);

            if (!cup.IsClean)
            {
                cup.Clean();
            }
            if (coffee != null)
            {
                cup.Fill(coffee);
            }
            Console.WriteLine(string.Format("Order Number:{0}", _orderNumber));
            Console.WriteLine(string.Format("Successfully filled coffee in {0} cup", cup.Color.Name));
            Console.WriteLine("---------------------------------");
        }
Ejemplo n.º 3
0
 protected abstract void ServeCoffeeInternal(CoffeeType type, ISmartCoffeeCup cup);