示例#1
0
            public When_performing_mutation_testing()
            {
                spyOutputWriter = new SpyOutputWriter();
                var listener = new VerboseEventListener(spyOutputWriter);

                listener.BeginMutationOfFile(@"c:\some-project\src\Class1.cs", @"c:\some-project", 0, 2);
                listener.MemberMutating("System.Void SomeProject.Class1::MethodA(System.Int32)");
                listener.SyntaxNodeMutating(0, 2);
                listener.SyntaxNodeMutating(1, 2);
                listener.MemberMutating("System.Int32 SomeProject.Class1::PropertyA");
                listener.SyntaxNodeMutating(0, 2);
                listener.SyntaxNodeMutating(1, 2);
                listener.EndMutationOfFile(@"src\Class1.cs");

                listener.BeginMutationOfFile(@"c:\some-project\src\Class2.cs", @"c:\some-project", 1, 2);
                listener.MemberMutating("System.Int32[] SomeProject.SomeOtherNamespace.Class2::MethodA()");
                listener.SyntaxNodeMutating(0, 2);
                listener.SyntaxNodeMutating(1, 2);
                listener.MutantSurvived(
                    new SurvivingMutant
                {
                    OriginalLine   = "a && b",
                    MutatedLine    = "a || b",
                    SourceFilePath = @"c:\some-project\src\Class2.cs",
                    SourceLine     = 23
                });
                listener.EndMutationOfFile(@"src\Class2.cs");
            }
示例#2
0
            public When_performing_mutation_testing_but_nothing_found_to_mutate()
            {
                spyOutputWriter = new SpyOutputWriter();
                var listener = new VerboseEventListener(spyOutputWriter);

                listener.BeginMutationOfFile(@"c:\some-project\src\Class1.cs", @"c:\some-project", 0, 2);
                listener.EndMutationOfFile(@"c:\some-project\src\Class1.cs");
            }
示例#3
0
            public When_performing_coverage_analysis()
            {
                spyOutputWriter = new SpyOutputWriter();
                var listener = new VerboseEventListener(spyOutputWriter);

                for (var testIndex = 0; testIndex < 15; ++testIndex)
                {
                    listener.BeginCoverageAnalysisOfTestCase($"Tests.Test{testIndex}", testIndex, 15);
                }
            }
示例#4
0
            public When_performing_coverage_analysis()
            {
                spyOutputWriter = new SpyOutputWriter();
                var listener = new VerboseEventListener(spyOutputWriter);

                listener.BeginCoverageAnalysisOfTestCase("Tests.TestA", 0, 3);
                listener.BeginCoverageAnalysisOfTestCase("Tests.TestB", 1, 3);
                listener.BeginCoverageAnalysisOfTestCase("Tests.TestC", 2, 3);

                listener.MemberCoveredByTests("example.methodA");
                listener.MemberCoveredByTests("example.methodA");
            }
示例#5
0
            public When_performing_mutation_testing()
            {
                spyOutputWriter = new SpyOutputWriter();
                var listener = new VerboseEventListener(spyOutputWriter);

                var testFailureDescription =
                    @"       Expected:
            true
         but was:
            false";


                listener.BeginMutationOfFile(@"c:\some-project\src\Class1.cs", @"c:\some-project", 0, 2);
                listener.MemberMutating("System.Void SomeProject.Class1::MethodA(System.Int32)");
                listener.SyntaxNodeMutating(0, 2);
                listener.SyntaxNodeMutating(1, 2);
                listener.MemberMutating("System.Int32 SomeProject.Class1::PropertyA");
                listener.SyntaxNodeMutating(0, 2);
                listener.SyntaxNodeMutating(1, 2);
                listener.MutantSkipped(
                    new Mutant
                {
                    OriginalLine   = "a == 0",
                    MutatedLine    = "a != 0",
                    SourceFilePath = @"c:\some-project\src\Class1.cs",
                    SourceLine     = 14
                }, "filtered out");
                listener.EndMutationOfFile(@"src\Class1.cs");

                listener.BeginMutationOfFile(@"c:\some-project\src\Class2.cs", @"c:\some-project", 1, 2);
                listener.MemberMutating("System.Int32[] SomeProject.SomeOtherNamespace.Class2::MethodA()");
                listener.SyntaxNodeMutating(0, 2);
                listener.MutantKilled(
                    new Mutant
                {
                    OriginalLine   = "a > 0",
                    MutatedLine    = "a >= 0",
                    SourceFilePath = @"c:\some-project\src\Class2.cs",
                    SourceLine     = 20
                },
                    testFailureDescription);
                listener.SyntaxNodeMutating(1, 2);
                listener.MutantSurvived(
                    new Mutant
                {
                    OriginalLine   = "a && b",
                    MutatedLine    = "a || b",
                    SourceFilePath = @"c:\some-project\src\Class2.cs",
                    SourceLine     = 23
                });
                listener.EndMutationOfFile(@"src\Class2.cs");
            }