Beispiel #1
0
        public static void Main()
        {
            var topBread      = new WheatBread();
            var topCondiments = new CondimentList(new List <ICondiment> {
                new MayoCondiment(), new MustardCondiment()
            });
            var ingredients = new IngredientList(new List <IIngredient> {
                new LettuceIngredient(), new ChickenIngredient()
            });
            var bottomCondiments = new CondimentList(new List <ICondiment> {
                new KetchupCondiment()
            });
            var bottomBread = new WheatBread();

            var sandwhich = new Sandwhich(topBread, topCondiments, ingredients, bottomCondiments, bottomBread);
            var context   = new Context();

            sandwhich.Interpret(context);
            Console.WriteLine(context.Output);
        }
Beispiel #2
0
        private static void Main(string[] args)
        {
            var sandwhich = new Sandwhich(
                new WheatBread(),
                new CondimentList(
                    new List <Condiment> {
                new MayoCondiment(), new MustardCondiment()
            }),
                new IngredientList(
                    new List <Ingredient> {
                new LettuceIngredient(), new ChickenIngredient()
            }),
                new CondimentList(new List <Condiment> {
                new KetchupCondiment()
            }),
                new WheatBread());

            sandwhich.Interpret(new Context());

            Console.ReadKey();
        }