Пример #1
0
        public void CallsTheDecorateeOnce()
        {
            // Arrange
            var spy = new SpyGreeter();

            var sut = new SimpleDecorator(spy);

            // Act
            sut.Greet("name");

            // Assert
            Assert.Equal(1, spy.CallCount);
        }
Пример #2
0
        public void ForwardsTheCallToDecorateeWithTheName()
        {
            // Arrange
            string name = "Christelle";

            var spy = new SpyGreeter();

            var sut = new SimpleDecorator(spy);

            // Act
            sut.Greet(name);

            // Assert
            Assert.Equal(name, spy.SuppliedName);
        }
Пример #3
0
        public void ProducesExpectedGreet()
        {
            // Arrange
            string name          = "John";
            string expectedGreet = "<Test Greet>";

            var spy = new SpyGreeter {
                ReturnedGreet = expectedGreet
            };

            var sut = new SimpleDecorator(spy);

            // Act
            string actualGreet = sut.Greet(name);

            // Assert
            Assert.Equal(expectedGreet, actualGreet);
        }