예제 #1
0
 public FormPhablet(IPhablet ph)
 {
     StartPosition = FormStartPosition.CenterScreen;
     InitializeComponent();
     phablet           = ph;
     pictureBox1.Image = ph.ShowPictureSD();
     Show();
 }
예제 #2
0
        public void TestCall()
        {
            AbstractFactory samsung = new SamsungFactory();
            IPhone          phone   = samsung.createPhone();
            IPhablet        phablet = samsung.createPhablet();
            SoundPlayer     sp      = new SoundPlayer();

            Assert.AreSame(phone.Call().GetType(), sp.GetType());
            Assert.AreSame(phablet.Call().GetType(), sp.GetType());

            AbstractFactory nokia        = new SamsungFactory();
            IPhone          nokiaphone   = nokia.createPhone();
            IPhablet        nokiaphablet = nokia.createPhablet();

            Assert.AreSame(nokiaphone.Call().GetType(), sp.GetType());
            Assert.AreSame(nokiaphablet.Call().GetType(), sp.GetType());

            AbstractFactory apple        = new SamsungFactory();
            IPhone          applephone   = apple.createPhone();
            IPhablet        applephablet = apple.createPhablet();

            Assert.AreSame(applephone.Call().GetType(), sp.GetType());
            Assert.AreSame(applephablet.Call().GetType(), sp.GetType());
        }