public When_performing_mutation_testing()
            {
                spyOutputWriter = new SpyOutputWriter();
                var listener = new DefaultEventListener(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 Mutant
                {
                    OriginalLine   = "a && b",
                    MutatedLine    = "a || b",
                    SourceFilePath = @"c:\some-project\src\Class2.cs",
                    SourceLine     = 23
                });
                listener.EndMutationOfFile(@"src\Class2.cs");
            }
Esempio n. 2
0
        private ITestEventListener GetTestEventListener(Options options)
        {
            if (!string.IsNullOrEmpty(options.RedisHost))
            {
                var redis      = ConnectionMultiplexer.Connect(options.RedisHost);
                var subscriber = redis.GetSubscriber();

                textWriter = new RedisQueueWriter(subscriber, options.QueueName);
            }

            ITestEventListener testEventListener = new DefaultEventListener(textWriter);

            if (options.Explore)
            {
                return(testEventListener);
            }

            if (options.Console)
            {
                return(new ConsoleEventListener(textWriter));
            }

            if (options.TeamCity)
            {
                return(new TeamCityEventListener(textWriter, new TeamCityInfo()));
            }

            return(testEventListener);
        }
            public When_a_mutant_is_killed_or_skipped_during_mutation_testing()
            {
                spyOutputWriter = new SpyOutputWriter();
                var listener = new DefaultEventListener(spyOutputWriter);

                listener.MutantKilled(new Mutant(), "Expected true but was false");
                listener.MutantSkipped(new Mutant(), "reason");
            }
            public When_performing_mutation_testing_but_nothing_found_to_mutate()
            {
                spyOutputWriter = new SpyOutputWriter();
                var listener = new DefaultEventListener(spyOutputWriter);

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

                for (var testIndex = 0; testIndex < 15; ++testIndex)
                {
                    listener.BeginCoverageAnalysisOfTestCase($"Tests.Test{testIndex}", testIndex, 15);
                }
            }