Example #1
0
        //protected override Plate preparePlate(string plate)
        //{
        //    Plate plateIn = null;
        //    ICeramicsFactory ceramicsFactory = new FactoryTaociChina();

        //    return plateIn;
        //}

        protected override Plate preparePlate(string plate)
        {
            Plate            plateIn         = null;
            ICeramicsFactory ceramicsFactory = new FactoryTaociChina();

            if (plate == "SmallPlate")
            {
                plateIn = new PlateDecorator(new SmallPLate(ceramicsFactory));
                Console.WriteLine(plateIn + "Zakład:" + this.GetType().Name);
            }
            else if (plate == "MediumPlate")
            {
                plateIn = new PlateDecorator(new MediumPlate(ceramicsFactory));
                Console.WriteLine(plateIn + "Zakład:" + this.GetType().Name);
            }
            else if (plate == "BigPlate")
            {
                plateIn = new PlateDecorator(new BigPlate(ceramicsFactory));
                Console.WriteLine(plateIn + "Zakład:" + this.GetType().Name);
            }
            else if (plate == "LuxuryPlate")
            {
                plateIn = new PlateDecorator(new LuxuryPlate(ceramicsFactory));
                Console.WriteLine(plateIn + "Zakład:" + this.GetType().Name);
            }
            else if (plate == "Vase")
            {
                plateIn = new VaseDecorator(new VaseAdapter(new Vase(ceramicsFactory)));
                Console.WriteLine(plateIn + "Zakład:" + this.GetType().Name);
            }

            return(plateIn);
        }
Example #2
0
        public void TestDecoratorPricaSum()
        {
            ICeramicsFactory ceramicsFactory = new FactoryCerluxPoland();
            Plate            plateIn         = new PlateDecorator(new SmallPLate(ceramicsFactory)) as PlateDecorator;

            // plateIn.Prepare();
            //plateIn.Firing();

            Assert.AreEqual(4.5, PlateDecorator.PriceOfPlates1);
        }
Example #3
0
        public void TestDecoratorNumberOfELements()
        {
            ICeramicsFactory ceramicsFactory = new FactoryCerluxPoland();
            Plate            plateIn         = new PlateDecorator(new SmallPLate(
                                                                      ceramicsFactory)) as PlateDecorator;

            plateIn.Prepare();
            plateIn.Firing();

            Assert.AreEqual(1, PlateDecorator.NumberOfPlate);
        }