Esempio n. 1
0
        public void TurkeyAdapter()
        {
            IDuck   mDuck   = new MallardDuck();
            ITurkey wTurkey = new WildTurkey();

            IDuck turkeyAdapter = new TurkeyAdapter(wTurkey);

            mDuck.Fly();
            mDuck.Quack();
            string expecteDuckBehavior = Strings.Fly + Strings.Quack;

            turkeyAdapter.Fly();
            turkeyAdapter.Quack();
            string expectedTurkeyAdapterBehavior = Strings.Fly + Strings.Fly + Strings.Fly +
                                                   Strings.Fly + Strings.Fly + Strings.Gobble;

            Assert.AreEqual(expecteDuckBehavior, mDuck.GetStatus());
            Assert.AreEqual(expectedTurkeyAdapterBehavior, turkeyAdapter.GetStatus());
            Assert.AreEqual(expectedTurkeyAdapterBehavior, wTurkey.GetStatus());
        }