Esempio n. 1
0
        /// <summary>
        /// Get Coffee given the Beverage Type
        /// Is Factory Method
        /// </summary>
        /// <param name="beverageType"></param>
        /// <returns></returns>
        public IBeverage GetCoffee(BeverageType beverageType)
        {
            IBeverage coffee = null;

            switch (beverageType)
            {
                case BeverageType.HouseBlend:
                    coffee = new SpecialHouseBlend();
                    break;

                case BeverageType.Roast:
                    coffee = new AmazonRoast();
                    break;
            }

            return coffee;
        }
Esempio n. 2
0
        public IBeverage GetCoffee(StoreType storeType, BeverageType beverageType)
        {
            IBeverage coffee = null;

            switch(storeType)
            {
                case StoreType.RegularStore :

                    switch (beverageType)
                    {
                        case BeverageType.HouseBlend:
                            coffee = new HouseBlend();
                            break;

                        case BeverageType.Roast:
                            coffee = new DarkRoast();
                            break;
                    }
                    break;

                case StoreType.ExoticStore:

                    switch (beverageType)
                    {
                        case BeverageType.HouseBlend:
                            coffee = new SpecialHouseBlend();
                            break;

                        case BeverageType.Roast:
                            coffee = new AmazonRoast();
                            break;
                    }
                    break;
            }

            return coffee;
        }