public string Order(DrinkCommand command, double credits = 0)
 {
     if (command != null)
     {
         if (credits >= command.Price)
         {
             return(command.CommandString());
         }
         return(new MessageCommand(
                    String.Format("Missing {0} credits.", command.Price - credits)
                    ).CommandString());
     }
     return(null);
 }
 private void IncreaseCounter(DrinkCommand command)
 {
     if ((command as CoffeeCommand) != null)
     {
         ++Report.CoffeeSold;
     }
     else if ((command as ChocolateCommand) != null)
     {
         ++Report.ChocolateSold;
     }
     else if ((command as TeaCommand) != null)
     {
         ++Report.TeaSold;
     }
     else
     {
         ++Report.OrangeJuiceSold;
     }
 }
 private void IncreaseCounter(DrinkCommand command)
 {
     if ((command as CoffeeCommand) != null)
     {
         ++_coffeeSold;
     }
     else if ((command as ChocolateCommand) != null)
     {
         ++_chocolateSold;
     }
     else if ((command as TeaCommand) != null)
     {
         ++_teaSold;
     }
     else
     {
         ++_ojSold;
     }
 }
 public string Order(DrinkCommand command, double credits = 0)
 {
     if (command != null)
     {
         if (_beverageQuantityChecker != null && _emailNotifier != null &&
             _beverageQuantityChecker.IsEmpty(command.GetType().ToString()))
         {
             _emailNotifier.NotifyMissingDrink(command.GetType().ToString());
             return(new MessageCommand(
                        String.Format("The drink is missing, a notification has been sent.")
                        ).CommandString());
         }
         else if (credits >= command.Price)
         {
             IncreaseCounter(command);
             IncreaseCreditCounter(command.Price);
             return(command.CommandString());
         }
         return(new MessageCommand(
                    String.Format("Missing {0} credits.", command.Price - credits)
                    ).CommandString());
     }
     return(null);
 }