Пример #1
0
        public void QuackTest()
        {
            var mallard      = new Mallard();
            var darkwingDuck = new DarkwingDuck();
            var toy          = new DarkwingDuckToy();

            Assert.Equal(mallard.Quack(), Quack(mallard));
            Assert.Equal(darkwingDuck.Quack(), Quack(darkwingDuck));
            Assert.Throws <Exception>(() => toy.Quack());
            toy.InsertBatteries();
            Assert.Equal(toy.Quack(), Quack(toy));
        }
        public void Mallard_can_quack()
        {
            // Arrange

            var duckUnderTest = new Mallard();

            // Act
            var result = duckUnderTest.Quack();


            // Asset
            Assert.That(result, Is.EqualTo("Quack!"));
        }
        public void Mallard_can_change_quack_to_muted()
        {
            // Arrange
            var duckUnderTest = new Mallard();

            duckUnderTest.QuackBehaviour = new MutedQuack();

            // Act
            var result = duckUnderTest.Quack();


            // Assert
            Assert.That(result, Is.EqualTo("..."));
        }