Esempio n. 1
0
        public static Menu GetMenu()
        {
            if (_instance is null)
            {
                ProductFactory           pizzaFactory      = new PizzaFactory();
                ItemFactory <Soda>       sodaFactory       = new SodaFactory();
                ItemFactory <Ingredient> ingredientFactory = new IngredientFactory();

                _instance = new Menu()
                {
                    Pizzas = new List <Product>
                    {
                        pizzaFactory.GetProduct(nameof(Margherita)),
                        pizzaFactory.GetProduct(nameof(Hawaii)),
                        pizzaFactory.GetProduct(nameof(Kebabpizza)),
                        pizzaFactory.GetProduct(nameof(QuatroStagioni))
                    },
                    Sodas = new List <Soda>
                    {
                        sodaFactory.GetItem(nameof(Fanta)),
                        sodaFactory.GetItem(nameof(CocaCola)),
                        sodaFactory.GetItem(nameof(Sprite))
                    },
                    Ingredients = new List <Ingredient>
                    {
                        ingredientFactory.GetItem(nameof(Ham)),
                        ingredientFactory.GetItem(nameof(Pineapple)),
                        ingredientFactory.GetItem(nameof(Mushrooms)),
                        ingredientFactory.GetItem(nameof(Onion)),
                        ingredientFactory.GetItem(nameof(KebabSauce)),
                        ingredientFactory.GetItem(nameof(Shrimps)),
                        ingredientFactory.GetItem(nameof(Mussels)),
                        ingredientFactory.GetItem(nameof(Artichoke)),
                        ingredientFactory.GetItem(nameof(Kebab)),
                        ingredientFactory.GetItem(nameof(Coriander)),
                    }
                };
            }

            return(_instance);
        }
Esempio n. 2
0
 public SodaBuilder(SodaFactory factory)
 {
     this.factory = factory;
     bottle       = factory.createBottle();
 }