public void SetupFactories() { _drinkFactory = new DrinkFactory(); _drinkIngredientFactory = new DrinkIngredientFactory(); _baristaInformer = new TestBaristaInformer(); _logger = new TestLogger(); }
public static void Prepare(IDrink drink, IBaristaInformer informer) { if (drink.IsValid) { string message = "We are preparing the following drink for you: " + drink.Description; informer.Inform(message); } else { throw new Exception("We could not prepare the following drink: " + drink.Description); } }
public AcuCafe(IDrinkFactory df, IDrinkIngredientFactory dif, IBaristaInformer bi, ILogger logger) { _drinkFactory = df; _drinkIngredientFactory = dif; _informer = bi; _logger = logger; // Ideally this would be done somewhere else, but we don't have time to build that somewhere else _drinkFactory.RegisterDrink("Espresso", typeof(Espresso)); _drinkFactory.RegisterDrink("HotTea", typeof(Tea)); _drinkFactory.RegisterDrink("IceTea", typeof(IceTea)); // Likewise for the ingredients, we register them here, but it really needs to be moved _drinkIngredientFactory.RegisterDrinkIngredient("milk", typeof(MilkIngredient)); _drinkIngredientFactory.RegisterDrinkIngredient("sugar", typeof(SugarIngredient)); _drinkIngredientFactory.RegisterDrinkIngredient("chocolate topping", typeof(ChocolateTopping)); }