public void TestWildTurkey()
        {
            Turkey wildTurkey = new WildTurkey();

            Assert.AreEqual("Gooble, gooble", wildTurkey.Gobble());
            Assert.AreEqual("I'm flying a short distance", wildTurkey.Fly());
        }
예제 #2
0
        private static void Main()
        {
            var turkey  = new WildTurkey();
            var adapter = new TurkeyAdapter(turkey);

            Tester(adapter);
        }
예제 #3
0
        public static void Main(string[] args)
        {
            MallardDuck duck = new MallardDuck();

            WildTurkey turkey        = new WildTurkey();
            IDuck      turkeyAdapter = new TurkeyAdapter(turkey);

            Console.WriteLine("The Turkey says...");
            turkey.Gobble();
            turkey.Fly();

            Console.WriteLine("\nThe Duck says...");
            TestDuck(duck);

            Console.WriteLine("\nThe TurkeyAdapter says...");
            TestDuck(turkeyAdapter);

            ITurkey duckAdapter = new DuckAdapter(duck);

            Console.WriteLine("");
            for (int i = 0; i < 10; i++)
            {
                Console.WriteLine("The DuckAdapter says...");
                duckAdapter.Gobble();
                duckAdapter.Fly();
            }
        }
 static void Main(string[] args)
 {
     var turkey = new WildTurkey();
     var duck = new DuckAdapter(turkey);
     duck.Sing();
     duck.Fly();
 }
예제 #5
0
        static void Main(string[] args)
        {
            List <DuckBase> ducks         = new List <DuckBase>();
            DuckBase        duck          = new MallardDuck();
            Turkey          turkey        = new WildTurkey();
            DuckBase        turkeyAdaptee = new TurkeyAdapter(turkey);

            ducks.AddRange(new DuckBase[] {
                new TurkeyAdapter(new WildTurkey()),
                new MallardDuck(),
                duck,
                turkeyAdaptee
            });

            foreach (var item in ducks)
            {
                item.Fly();
                item.Quack();

                Console.WriteLine("================");
            }



            Console.ReadKey();
        }
예제 #6
0
파일: Program.cs 프로젝트: T0person/Practic
        static void Main(string[] args)
        {
            MallardDuck duck   = new MallardDuck();
            WildTurkey  turkey = new WildTurkey();

            IDuck turkeyAdapter = new TurkeyAdapter(turkey);

            Console.WriteLine("\t---Turkey!!!---");
            turkey.Fly();
            turkey.Gobble();
            // Ошибка так как Turkey реализует интерфейс ITurkey
            //TestDuck(turkey);
            TestDuck(turkeyAdapter);

            Console.WriteLine("\n\t---Duck!!!---");
            duck.Fly();
            duck.Quack();

            Console.WriteLine("\t---Turkey!!!---");
            TestDuck(turkeyAdapter);

            Console.WriteLine("\n\t---Duck!!!---");
            TestDuck(duck);

            Console.WriteLine("\n\t---Duck!!!---");
            ITurkey duckAdapter = new DuckAdapter(duck);

            duckAdapter.Fly();
            duckAdapter.Gobble();
        }
예제 #7
0
        static void Main(string[] args)
        {
            IDuck duck = new MallardDuck();

            duck.Fly();
            duck.Quack();
            Console.WriteLine();

            ITurkey turkey = new WildTurkey();

            turkey.Fly();
            turkey.Gobble();
            Console.WriteLine();

            IDuck adapterDuck = new TurkeyAdapter(turkey);

            adapterDuck.Fly();
            adapterDuck.Quack();
            Console.WriteLine();

            ITurkey adapterTurkey = new DuckAdapter(duck);

            adapterTurkey.Fly();
            adapterTurkey.Gobble();

            Console.ReadKey();
        }
예제 #8
0
        static void Main(string[] args)
        {
            var turkey = new WildTurkey();
            var duck   = new DuckAdapter(turkey);

            duck.Sing();
            duck.Fly();
        }
예제 #9
0
        static void Main(string[] args)
        {
            WildTurkey turkey        = new WildTurkey();
            Duck       turkeyAdapter = new TurkeyAdapter(turkey);

            turkeyAdapter.quack();
            turkeyAdapter.fly();
        }
        public void Adapter_TurkeyCanQuack()
        {
            ITurkey turkey        = new WildTurkey();
            IDuck   adaptedTurkey = new TurkeyAdapter(turkey);

            var quack = adaptedTurkey.Quack();

            Assert.AreEqual("Gobble gobble gobble!", quack);
        }
예제 #11
0
        static void Main(string[] args)
        {
            ITurkey turkey        = new WildTurkey();
            Duck    turkeyAdapter = new TurkeyAdapter(turkey);

            turkeyAdapter.Display();
            turkeyAdapter.Fly();
            turkeyAdapter.Quack();
            turkeyAdapter.Swim();
        }
        public void TurkeyShouldGobble()
        {
            var expected = "gobble gobble";

            WildTurkey wildTurkey = new WildTurkey();

            var result = wildTurkey.Gobble();

            result.Should().Be(expected);
        }
예제 #13
0
        static void Main(string[] args)
        {
            WildTurkey turkey        = new WildTurkey();
            IDuck      turkeyAdapter = new TurkeyAdapter(turkey);

            turkey.Gobble();
            turkey.Fly();
            turkeyAdapter.Quack();
            turkeyAdapter.Fly();
        }
예제 #14
0
        private void RunAdapterExample()
        {
            Duck    rubberDuck = new RubberDuck();
            ITurkey wildTurkey = new WildTurkey();

            TurkeyToDuckAdapter turkey = new TurkeyToDuckAdapter(wildTurkey);

            turkey.PerformFly();
            turkey.PerformQuack();
        }
예제 #15
0
        public void AdapterTest()
        {
            IDuck mallardDuck = new MallardDuck();

            ITurkey turkey = new WildTurkey();
            IDuck   duck   = new TurkeyAdapter(turkey);

            TestDuck(mallardDuck);
            TestDuck(duck);
        }
예제 #16
0
        public void TestTurkeyAdapter()
        {
            Turkey wildTurkey    = new WildTurkey();
            Duck   turkeyAdapter = new TurkeyAdapter(wildTurkey);

            Assert.AreEqual("Gobble, gobble", turkeyAdapter.quack());
            Assert.AreEqual("I'm flying a short distance!\n" + "I'm flying a short distance!\n" +
                            "I'm flying a short distance!\n" + "I'm flying a short distance!\n" +
                            "I'm flying a short distance!\n", turkeyAdapter.fly());
        }
        public void TurkeyShouldFly()
        {
            var expected = "flap flap";

            WildTurkey wildTurkey = new WildTurkey();

            var result = wildTurkey.Fly();

            result.Should().Be(expected);
        }
        public void TestAdapter()
        {
            var turkey  = new WildTurkey();
            var adapter = new TurkeyAdapter(turkey);

            turkey.Fly();
            turkey.Gobble();

            adapter.Fly();
            adapter.Quack();
        }
예제 #19
0
    private void Start()
    {
        MallardDuck duck          = new MallardDuck();
        WildTurkey  turkey        = new WildTurkey();
        Duck        turkeyAdapter = new TurkeyAdapter(turkey);

        Debug.Log("오리 사용...");
        testDuck(duck);

        Debug.Log("칠면조로 대체...");
        testDuck(turkeyAdapter);
    }
예제 #20
0
        static void Main(string[] args)
        {
            var duck = new MallardDuck();

            var turkey = new WildTurkey();

            IDuck turkeyAdapter = new TurkeyAdapter(turkey);

            TestDuck(turkeyAdapter);

            var uniqObject = Singleton.Singleton.GetInstanse();
        }
    static void Main()
    {
        MallardDuck   duck          = new MallardDuck();
        WildTurkey    turkey        = new WildTurkey();
        TurkeyAdapter turkeyAdapter = new TurkeyAdapter(turkey);

        System.Console.WriteLine("The tukey says...");
        turkeyAdapter.Quack();
        turkeyAdapter.Fly();

        System.Console.WriteLine("\nThe Duck says...");
        duck.Quack();
        duck.Fly();
    }
예제 #22
0
        static void Main(string[] args)
        {
            MallardDuck mallardDuck = new MallardDuck();
            WildTurkey  turkey      = new WildTurkey();

            TestDuck(mallardDuck);
            TestTurkey(turkey);
            IDuck turkeyAdapter = new TurkeyAdapter(turkey);

            TestDuck(turkeyAdapter);
            ITurkey duckAdapter = new DuckAdapter(mallardDuck);

            TestTurkey(duckAdapter);
        }
        public void TurkeyShouldPassAsDuck()
        {
            var expected = "gobble gobble";

            WildTurkey turkey = new WildTurkey();

            TurkeyAdapter turkeyAdapter = new TurkeyAdapter(turkey);

            TestDuck(turkeyAdapter);

            var result = turkeyAdapter.Quack();

            result.Should().Be(expected);
        }
예제 #24
0
        public static void Start()
        {
            var duck           = new MallardDuck();
            var turkey         = new WildTurkey();
            var turkeyLikeDuck = new TurkeyAdapter(turkey);

            duck.Quack();
            duck.Fly();

            turkey.Gobble();
            turkey.Fly();

            turkeyLikeDuck.Quack();
            turkeyLikeDuck.Fly();
        }
예제 #25
0
        static void Main(string[] args)
        {
            MallardDuck mallard       = new MallardDuck();
            WildTurkey  wild          = new WildTurkey();
            IDuck       turkeyAdapter = new TurkeyAdapter(wild);

            Console.WriteLine("The Turkey says...");
            wild.Gobble();
            wild.Fly();
            Console.WriteLine("\nThe Duck says...");
            TestDuck(mallard);

            Console.WriteLine("The TurkeyAdapter says...");
            TestDuck(turkeyAdapter);
        }
        static void Main(string[] args)
        {
            MallardDuck duck   = new MallardDuck();
            WildTurkey  turkey = new WildTurkey();

            IDuck fakeTurkey = new TurkeyAdapter(turkey);

            Console.WriteLine("\n----------Turkey Said-----------\n");
            turkey.Gobble();
            turkey.Fly();

            Console.WriteLine("\n-----------Duck Said---------\n");
            TestDuck(duck);
            Console.WriteLine("\n----------FakeTurkey Said----------\n");
            TestDuck(fakeTurkey);
        }
        static void Main(string[] args)
        {
            var duck          = new MallardDuck();
            var turkey        = new WildTurkey();
            var turkeyAdapter = new TurkeyAdaptor(turkey);

            Console.WriteLine("The turkey says...");
            turkey.Gobble();
            turkey.Fly();

            Console.WriteLine("\nThe duck says...");
            testDuck(duck);

            Console.WriteLine("\nThe turkey adaptor says...");
            testDuck(turkeyAdapter);
        }
        static void Main(string[] args)
        {
            MallardDuck duck   = new MallardDuck();
            WildTurkey  turkey = new WildTurkey();

            IDuck turkeyAdapter = new TurkeyAdapter(turkey);

            duck.Quack();
            duck.Fly();

            turkey.Gobble();
            turkey.Fly();

            turkeyAdapter.Quack();
            turkeyAdapter.Fly();
        }
예제 #29
0
        public static void Test()
        {
            Duck duck = new MallardDuck();

            Turkey turkey        = new WildTurkey();
            Duck   turkeyAdapter = new TurkeyAdapter(turkey);

            Console.WriteLine("The Turkey says...");
            turkey.gobble();
            turkey.fly();

            Console.WriteLine("\nThe Duck says...");
            testDuck(duck);

            Console.WriteLine("\nThe TurkeyAdapter says...");
            testDuck(turkeyAdapter);
        }
예제 #30
0
        static void Main(string[] args)
        {
            MallardDuck duck          = new MallardDuck();
            WildTurkey  turkey        = new WildTurkey();
            IDuck       turkeyAdapter = new TurkeyAdapter(turkey);

            Console.WriteLine("The Turkey says...");
            turkey.Gobble();
            turkey.Fly();
            Console.WriteLine("\nThe Duck says...");
            TestDuck(duck);

            Console.WriteLine("\nThe TurkeyAdapter says...");
            TestDuck(turkeyAdapter);

            Console.ReadLine();
        }
        public void TurkeyAdapterTest()
        {
            MallardDuck duck = new MallardDuck();

            WildTurkey turkey        = new WildTurkey();
            IDuck      turkeyAdapter = new TurkeyAdapter(turkey);

            Console.WriteLine("The Turkey says...");
            turkey.Gobble();
            turkey.Fly();

            Console.WriteLine($"{Environment.NewLine}The Duck says...");
            TestDuck(duck);

            Console.WriteLine($"{Environment.NewLine}The TurkeyAdapter says...");
            TestDuck(turkeyAdapter);
        }
예제 #32
0
        private static void Main(string[] args)
        {
            var duck = new MallardDuck();

            var turkey = new WildTurkey();
            var turkeyAdapter = new TurkeyAdapter(turkey);

            Console.WriteLine("The turkey says...");
            turkey.Gobble();
            turkey.Fly();

            Console.WriteLine("Duck says...");
            TestDuck(duck);

            Console.WriteLine("The turkeyAdapter says...");
            TestDuck(turkeyAdapter);

            Console.ReadLine();
        }