Ejemplo n.º 1
0
 public void PlayIPhone(iPhone lumia)
 {
     Console.WriteLine("This is {0} play {1}", this.Name, lumia.GetType());
     lumia.Brand();
     lumia.Call();
     lumia.Photo();
 }
Ejemplo n.º 2
0
        public void TestCreatePhone()
        {
            GalaxyMini      phone   = new GalaxyMini();
            AbstractFactory samsung = new SamsungFactory();

            Assert.AreSame(phone.GetType(), samsung.createPhone().GetType());

            iPhone          applephone = new iPhone();
            AbstractFactory apple      = new AppleFactory();

            Assert.AreSame(applephone.GetType(), apple.createPhone().GetType());

            Lumia           nokiaphone = new Lumia();
            AbstractFactory nokia      = new NokiaFactory();

            Assert.AreSame(nokiaphone.GetType(), nokia.createPhone().GetType());
        }