Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var mallard = new MallardDuck();
            mallard.PerformFly();
            mallard.PerformQuack();
            mallard.Display();
            mallard.Swim();

            var modelDuck = new ModelDuck();
            modelDuck.Display();
            modelDuck.PerformFly();
            modelDuck.FlyBehaviour = new FlyRocketPowered();
            modelDuck.PerformFly();
            Console.ReadLine();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Duck mallard = new MallardDuck();

            mallard.Display();
            mallard.PerformQuack();
            mallard.PerformFly();

            Console.WriteLine("===");

            Duck model = new ModelDuck();

            model.Display();
            mallard.PerformQuack();
            model.PerformFly();
            model.SetFlyBehavior(new FlyRocketPowered());
            model.PerformFly();

            Console.ReadKey();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Duck mallard = new MallardDuck();

            mallard.Display();
            mallard.performQuack();
            mallard.performFly();


            Duck model = new ModelDuck();

            model.Display();
            model.performFly();
            model.SetFlyBehavior(new FlyRocketPowered());
            model.performFly();

            Console.WriteLine("The following is a duck call");
            DuckCall duckCall = new DuckCall(new RegularQuack());

            duckCall.Quack();

            Console.ReadLine();
        }
        public void duck_is_a_model_duck()
        {
            Duck model = new ModelDuck();

            Assert.AreEqual("I'm a model duck", model.Display());
        }