public void MallarDuck_Should_Quack_Swim_Fly_Display()
        {
            Duck mallarDuck = new MallarDuck();

            Assert.Equal("quack", mallarDuck.PerformQuack());
            Assert.Equal("swim", mallarDuck.Swim());
            Assert.Equal("fly", mallarDuck.PerformFly());
            Assert.Equal("looks like a mallard", mallarDuck.Display());
        }
예제 #2
0
        static void Main(string[] args)
        {
            Duck mallarDuck = new MallarDuck();

            mallarDuck.SetFlyBehavior(new FlyNoWay());

            mallarDuck.Display();
            mallarDuck.PerformFly();
            mallarDuck.SetFlyBehavior(new FlyWithWings());
            mallarDuck.PerformFly();
            Console.ReadLine();
        }
예제 #3
0
        public void MallarDuck_ShuldQuackAndFlyAndDisplay()
        {
            //Arrange
            Duck mallar = new MallarDuck();

            //Act
            var fly     = mallar.PerformFly();
            var quack   = mallar.PerformQuack();
            var display = mallar.Display();

            //Assert
            fly.Should().Be("I'm flying!!");
            quack.Should().Be("Quack");
            display.Should().Be("I'm a real Mallard duck");
        }