Example #1
0
        public void TestSingletonPoland()
        {
            CerluxPoland cerluxPoland  = CerluxPoland.Instance;
            CerluxPoland cerluxPoland2 = CerluxPoland.Instance;

            Assert.AreSame(cerluxPoland, cerluxPoland2);
        }
Example #2
0
        public void TestFactoryPolandCheckNameAfterPrepare1()
        {
            CerluxPoland cerluxPoland = CerluxPoland.Instance;

            var a = (PlateDecorator)cerluxPoland.PurchasePlate("SmallPlate");

            a.Prepare();
            var x = a.Plate;

            Assert.AreEqual(4.50, x.price);
        }
Example #3
0
        public void TestFactoryPoland()
        {
            CerluxPoland cerluxPoland = CerluxPoland.Instance;

            var a = (PlateDecorator)cerluxPoland.PurchasePlate("SmallPlate");
            var x = a.Plate;

            Assert.AreEqual(typeof(SmallPLate), x.GetType());

            Assert.IsInstanceOf <SmallPLate>(x);
        }
Example #4
0
        static void Main(string[] args)
        {
            CerluxPoland cerluxPoland = CerluxPoland.Instance;
            TaociChina   taociChina   = TaociChina.Instance;

            string[] plates = new string[] { "SmallPlate", "MediumPlate", "BigPlate", "LuxuryPlate" };

            Order orderOfPlatesCerlux = new Order();

            //Plate plate = cerluxPoland.PurchasePlate("SmallPlate");
            foreach (string p in plates)
            {
                orderOfPlatesCerlux.addItem(cerluxPoland.PurchasePlate(p));
            }

            //Console.WriteLine("Do zrobienia");

            Order orderPlatesTaoci = new Order();

            foreach (string p in plates)
            {
                orderPlatesTaoci.addItem(taociChina.PurchasePlate(p));
            }

            orderPlatesTaoci.addItem(taociChina.PurchasePlate("Vase"));


            Seller potter = new Seller();

            Console.WriteLine("Garncarz skończył pracę nad zamówieniem");
            orderOfPlatesCerlux.AttachObserver(potter);

            firing(orderOfPlatesCerlux);

            Console.WriteLine("Zrobiona ilość tależy " + PlateDecorator.NumberOfPlate + " za cenę " + PlateDecorator.PriceOfPlates1);

            Console.WriteLine("Zrobiona ilość waz " + VaseDecorator.NumberOfPlate + " za cenę " + VaseDecorator.PriceOfPlates1);
            /////////////////////////////////////////////////////////////////
            orderPlatesTaoci.AttachObserver(potter);

            firing(orderPlatesTaoci);


            Console.WriteLine("Zrobiona ilość tależy " + PlateDecorator.NumberOfPlate + " za cenę " + PlateDecorator.PriceOfPlates1);

            Console.WriteLine("Zrobiona ilość waz " + VaseDecorator.NumberOfPlate + " za cenę " + VaseDecorator.PriceOfPlates1);

            orderOfPlatesCerlux.RemoveObserver(potter);
            //firing(orderOfPlatesCerlux);


            CerluxPoland cerluxPoland1 = CerluxPoland.Instance;

            var a = (PlateDecorator)cerluxPoland1.PurchasePlate("SmallPlate");
            var x = a.Plate;

            //Assert.IsInstanceOf(typeof(SmallPLate), x.GetType());

            Console.WriteLine(x.GetType() + " " + typeof(SmallPLate));
            // Assert.

            IMyData <int> array = new MyData <int>();

            array.AddItem(5);
            array.AddItem(6);
            array.AddItem(8);

            array.Find(6);
        }