Пример #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()
            {
                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");
            }