Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            var context = new Context();

            var ingredients = new List <IExpression> {
                new Avocado(), new Tomato(), new Avocado()
            };
            var topBread    = new WheatBread();
            var bottomBread = new WhiteBread();
            var sandwich    = new Sandwich(topBread, new Ingredients(ingredients), bottomBread);

            sandwich.Interpret(context);

            Console.ReadKey();
        }
Ejemplo n.º 2
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);
        }