コード例 #1
0
 public void SetupFactories()
 {
     _drinkFactory           = new DrinkFactory();
     _drinkIngredientFactory = new DrinkIngredientFactory();
     _baristaInformer        = new TestBaristaInformer();
     _logger = new TestLogger();
 }
コード例 #2
0
 public NewAcuCafe(ILogger logger,
                       IMessageWriter messageWriter,
                         IDrinkFactory drinkFactory,
                             IDrinkPreperationFactory drinkPreperationFactory)
 {
     this.logger = logger;
     this.messageWriter = messageWriter;
     this.drinkFactory = drinkFactory;
     this.drinkPreperationFactory = drinkPreperationFactory;
 }
コード例 #3
0
 public RestaurantController(IFoodFactory foodFactory, IDrinkFactory drinkFactory,
                             ITableFactory tableFactory)
 {
     this.menu         = new List <IFood>();
     this.drinks       = new List <IDrink>();
     this.tables       = new List <ITable>();
     this.foodFactory  = foodFactory;
     this.drinkFactory = drinkFactory;
     this.tableFactory = tableFactory;
 }
コード例 #4
0
 public RestaurantController(
     )
 {
     tables       = new List <ITable>();
     menu         = new List <IFood>();
     drinks       = new List <IDrink>();
     foodFactory  = new FoodFactory();
     drinkFactory = new DrinkFactory();
     tableFactory = new TableFactory();
 }
コード例 #5
0
        public RestaurantController()
        {
            this.menu   = new List <IFood>();
            this.drinks = new List <IDrink>();
            this.tables = new List <ITable>();

            this.foodFactory  = new FoodFactory();
            this.drinkFactory = new DrinkFactory();
            this.tableFactory = new TableFactory();

            this.totalIncome = 0;
        }
コード例 #6
0
ファイル: AcuCafe.cs プロジェクト: robotii/AcuCafe
        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));
        }
コード例 #7
0
 /// <summary>
 /// Constructor. Any service required by class is passed in to avoid dependencies
 /// </summary>
 /// <param name="drinkFactory">
 /// Factory which processes the drink's parameters
 /// </param>
 /// <param name="preparer">
 /// Responsible for processing the drink
 /// </param>
 /// <param name="logger">
 /// Responsible for IO
 /// </param>
 public AcuCafe(IDrinkFactory drinkFactory, IPreparer preparer, IOutputter logger)
 {
     DrinkFactory = drinkFactory;
     Preparer     = preparer;
     Logger       = logger;
 }
コード例 #8
0
ファイル: AcuCafe.cs プロジェクト: srivathsah/Acucafe
 public AcuCafe(IDrinkFactory drinkFactory, IDrinkValidatorFactory drinkValidatorFactory)
 {
     _drinkFactory          = drinkFactory;
     _drinkValidatorFactory = drinkValidatorFactory;
 }
コード例 #9
0
 public void Add(string key, IDrinkFactory drinkFactory)
 {
     _drinkFactories.Add(key, drinkFactory);
 }