Example #1
0
 /// <summary>
 /// OrderDrink functions by calling other classes' methods to create an
 /// IDrink object and process it.
 /// </summary>
 /// <param name="type">
 /// Type of the drink to be created
 /// </param>
 /// <param name="hasSugar">
 /// Does the drink have sugar?
 /// </param>
 /// <param name="hasMilk">
 /// Does the drink have Milk? Defaults to false
 /// </param>
 /// <param name="hasChocolate">
 /// Does the drink have Chocolate? Defaults to false
 /// </param>
 /// <returns>
 /// The Drink created, null if an error occurs
 /// </returns>
 public IDrink OrderDrink(EDrinks type, bool hasSugar, bool hasMilk = false, bool hasChocolate = false)
 {
     try
     {
         IDrink drink = DrinkFactory.BuildDrink(type, hasMilk, hasSugar, hasChocolate);
         Prepare(drink);
         return(drink);
     }
     catch (Exception ex)
     {
         Logger.LogError(ex);
         return(null);
     }
 }