예제 #1
0
        public void ShouldPrintCorrectColorWithRedAPI()
        {
            var expected = $"Drawing Circle [ color: red, radius: {radius} x: {x}, y: {y}";

            SUT = new CircleBuilder().WithDimensions(x: x, y: y, radius: radius).WithRedAPI();

            SUT.draw();

            Assert.IsTrue(Redirector.ToString().Contains(expected));
        }
        public void OneIsOne()
        {
            using (ConsoleRedirector cr = new ConsoleRedirector())
            {
                Assert.IsFalse(cr.ToString().Contains("New text"));

                /* call some method that writes "New text" to stdout */
                Console.Write("New text");
                Assert.IsTrue(cr.ToString().Contains("New text"));
            }
        }
예제 #3
0
        public void PrintRectangleShapeName()
        {
            //Arrange
            var expected = $"Shape: {nameof(Rectangle)}";

            //Sanity Check Assert
            Assert.IsFalse(Redirector.ToString().Contains(expected));

            //Act
            SUT.draw();

            //Assert
            Assert.IsTrue(Redirector.ToString().Contains(expected));
        }
예제 #4
0
        public void PrintRedCircleName()
        {
            //Arrange
            SUT = new RedShapeDecoratorBuilder().WithCircle();

            var expected  = $"Shape: {nameof(Circle)}";
            var expected2 = $"Border Color: Red";

            //Act
            SUT.draw();

            //Assert: 1 Logical assertion
            Assert.IsTrue(Redirector.ToString().Contains(expected));
            Assert.IsTrue(Redirector.ToString().Contains(expected2));
        }