Ejemplo n.º 1
0
        protected void Given_some_mutants_will_survive()
        {
            var baseSlnDir = Path.Combine(TestContext.CurrentContext.TestDirectory, "..", "..", "..", "..");

            var survivingMutant = new SurvivingMutant
            {
                SourceFilePath = Path.Combine(baseSlnDir, "someclass.cs"),
                SourceLine     = 123,
                OriginalLine   = "a+b",
                MutatedLine    = "a-b"
            };

            MockMutationTestRunner
            .Setup(r => r.Run(It.IsAny <Config>()))
            .Callback(() =>
            {
                // Raise events that a real MutationTestRunner would raise.
                var classFilePath = Path.Combine(baseSlnDir, "someclass.cs");
                eventListener.BeginMutationOfFile(classFilePath, baseSlnDir, 0, 1);
                eventListener.MemberMutating("System.Void SomeProject.SomeOtherNamespace.SomeClass::SomeMethod(System.Int32)");
                eventListener.SyntaxNodeMutating(0, 1);
                eventListener.MutantSurvived(survivingMutant);
                eventListener.EndMutationOfFile(classFilePath);
            })
            .Returns(Task.FromResult(new MutationTestResult().WithSurvivingMutants(new [] { survivingMutant })));
        }
Ejemplo n.º 2
0
        protected void Given_mutation_testing_will_return_errors()
        {
            Given_a_valid_config_file();

            MockMutationTestRunner
            .Setup(r => r.Run(It.IsAny <Config>()))
            .Returns(Task.FromResult(new MutationTestResult().WithError("an example error")));
        }
Ejemplo n.º 3
0
 protected void Given_mutation_testing_will_throw_an_exception(Exception ex)
 {
     MockMutationTestRunner
     .Setup(r => r.Run(It.IsAny <Config>()))
     .Throws(ex);
 }
Ejemplo n.º 4
0
 protected void Given_no_mutants_will_survive()
 {
     MockMutationTestRunner
     .Setup(r => r.Run(It.IsAny <Config>()))
     .Returns(Task.FromResult(new MutationTestResult()));
 }