Example #1
0
        public void ConsoleDotReporter_ShouldPrintRightCharOnMutation(MutantStatus givenStatus, string expectedOutput, string color)
        {
            var textWriter = new StringWriter();
            var target     = new ConsoleDotProgressReporter(textWriter);

            target.OnMutantTested(new Mutant()
            {
                ResultStatus = givenStatus
            });

            if (color == "default")
            {
                textWriter.AnyForegroundColorSpanCount().ShouldBe(0);
            }

            if (color == "red")
            {
                textWriter.RedSpanCount().ShouldBe(1);
            }

            textWriter.RemoveAnsi().ShouldBe(expectedOutput);
        }
        public void ConsoleDotReporter_ShouldPrintRightCharOnMutation(MutantStatus givenStatus, string expectedOutput, string color)
        {
            var console = new TestConsole().EmitAnsiSequences();
            var target  = new ConsoleDotProgressReporter(console);

            target.OnMutantTested(new Mutant()
            {
                ResultStatus = givenStatus
            });

            if (color == "default")
            {
                console.Output.AnyForegroundColorSpanCount().ShouldBe(0);
            }

            if (color == "red")
            {
                console.Output.RedSpanCount().ShouldBe(1);
            }

            console.Output.RemoveAnsi().ShouldBe(expectedOutput);
        }
Example #3
0
        public void ConsoleDotReporter_ShouldPrintRightCharOnMutation(MutantStatus givenStatus, string expectedOutput, string color)
        {
            string output    = "";
            var    chalkMock = new Mock <IChalk>(MockBehavior.Strict);

            chalkMock.Setup(x => x.Red(It.IsAny <string>())).Callback((string text) => { output += text; });
            chalkMock.Setup(x => x.Default(It.IsAny <string>())).Callback((string text) => { output += text; });
            var target = new ConsoleDotProgressReporter(chalkMock.Object);

            target.OnMutantTested(new Mutant()
            {
                ResultStatus = givenStatus
            });
            if (color == "default")
            {
                chalkMock.Verify(x => x.Default(It.IsAny <string>()));
            }
            if (color == "red")
            {
                chalkMock.Verify(x => x.Red(It.IsAny <string>()));
            }
            output.ShouldBe(expectedOutput);
        }