Пример #1
0
        public static void OrderCakeWithCreamCherryScent()
        {
            CakeBase cBase = new CakeBase();

            PrintProductDetails(cBase);

            // Lets add cream to the cake
            CreamDecorator creamCake = new CreamDecorator(cBase);

            PrintProductDetails(creamCake);

            // Let now add a Cherry on it
            CherryDecorator cherryCake = new CherryDecorator(creamCake);

            PrintProductDetails(cherryCake);

            // Lets now add Scent to it
            ArtificialScent scentedCake = new ArtificialScent(cherryCake);

            PrintProductDetails(scentedCake);

            // Finally add a Name card on the cake
            NameCardDecorator nameCardOnCake = new NameCardDecorator(scentedCake);

            PrintProductDetails(nameCardOnCake);

            // Lets now create a simple Pastry
        }
Пример #2
0
        public static void OrderPastryWithCream()
        {
            PastryBase pastry = new PastryBase();

            PrintProductDetails(pastry);

            // Lets just add cream and cherry only on the pastry
            CreamDecorator  creamPastry  = new CreamDecorator(pastry);
            CherryDecorator cherryPastry = new CherryDecorator(creamPastry);

            PrintProductDetails(cherryPastry);
        }