Exemplo 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();
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            Sandwich sandhich = new Sandwich(
                new WheatBread(),
                new CondimentList(
                    new List <ICondiment> {
                new MayoCondiment(), new MustardCondiment()
            }),
                new IngredientList(
                    new List <IIngredient> {
                new LettuceIngredient(), new ChickenIngredient()
            }),
                new CondimentList(new List <ICondiment> {
                new KetchupCondiment()
            }),
                new WheatBread());

            sandhich.Interpret(new Context());

            Console.ReadKey();
        }