public void MutationTestExecutor_TimeoutShouldBePassedToProcessTimeout() { var testRunnerMock = new Mock <ITestRunner>(MockBehavior.Strict); var mutant = new Mutant { Id = 1 }; testRunnerMock.Setup(x => x.RunAll(It.IsAny <int>(), mutant)).Returns(new TestRunResult { Success = false }); var target = new MutationTestExecutor(testRunnerMock.Object); target.Test(mutant, 1999); mutant.ResultStatus.ShouldBe(MutantStatus.Killed); testRunnerMock.Verify(x => x.RunAll(1999, mutant), Times.Once); }
public void MutationTestExecutor_FailedTestShouldBeKilled() { var testRunnerMock = new Mock <ITestRunner>(MockBehavior.Strict); var mutant = new Mutant { Id = 1, MustRunAgainstAllTests = true }; testRunnerMock.Setup(x => x.RunAll(It.IsAny <int>(), mutant, null)).Returns(new TestRunResult(false)); var target = new MutationTestExecutor(testRunnerMock.Object); target.Test(new List <Mutant> { mutant }, 0, null); mutant.ResultStatus.ShouldBe(MutantStatus.Killed); testRunnerMock.Verify(x => x.RunAll(It.IsAny <int>(), mutant, null), Times.Once); }
public void MutationTestExecutor_NoFailedTestShouldBeSurvived() { var testRunnerMock = new Mock <ITestRunner>(MockBehavior.Strict); var mutant = new Mutant { Id = 1 }; testRunnerMock.Setup(x => x.RunAll(It.IsAny <int>(), mutant)).Returns(new TestRunResult { Success = true }); var target = new MutationTestExecutor(testRunnerMock.Object); target.Test(mutant, 0); mutant.ResultStatus.ShouldBe(MutantStatus.Survived); testRunnerMock.Verify(x => x.RunAll(It.IsAny <int>(), mutant), Times.Once); }
public void MutationTestExecutor_FailedTestShouldBeKilled() { var testRunnerMock = new Mock <ITestRunner>(MockBehavior.Strict); var mutant = new Mutant { Id = 1, CoveringTests = TestsGuidList.EveryTest() }; testRunnerMock.Setup(x => x.TestMultipleMutants(null, It.IsAny <IReadOnlyList <Mutant> >(), null)).Returns(new TestRunResult(false)); var target = new MutationTestExecutor(testRunnerMock.Object); target.Test(new List <Mutant> { mutant }, null, null); mutant.ResultStatus.ShouldBe(MutantStatus.Killed); testRunnerMock.Verify(x => x.TestMultipleMutants(null, It.IsAny <IReadOnlyList <Mutant> >(), null), Times.Once); }
public void MutationTestExecutor_NoFailedTestShouldBeSurvived() { var testRunnerMock = new Mock <ITestRunner>(MockBehavior.Strict); var mutant = new Mutant { Id = 1 }; testRunnerMock.Setup(x => x.TestMultipleMutants(It.IsAny <ITimeoutValueCalculator>(), It.IsAny <IReadOnlyList <Mutant> >(), null)).Returns(new TestRunResult(true)); var target = new MutationTestExecutor(testRunnerMock.Object); target.Test(new List <Mutant> { mutant }, null, null); mutant.ResultStatus.ShouldBe(MutantStatus.Survived); testRunnerMock.Verify(x => x.TestMultipleMutants(It.IsAny <ITimeoutValueCalculator>(), It.IsAny <IReadOnlyList <Mutant> >(), null), Times.Once); }
public void MutationTestExecutor_TimeoutShouldBePassedToProcessTimeout() { var testRunnerMock = new Mock <ITestRunner>(MockBehavior.Strict); var mutant = new Mutant { Id = 1, MustRunAgainstAllTests = true }; testRunnerMock.Setup(x => x.RunAll(It.IsAny <int>(), mutant, null)). Returns(TestRunResult.TimedOut(TestListDescription.NoTest(), TestListDescription.NoTest(), TestListDescription.EveryTest(), "")); var target = new MutationTestExecutor(testRunnerMock.Object); target.Test(new List <Mutant> { mutant }, 1999, null); mutant.ResultStatus.ShouldBe(MutantStatus.Timeout); testRunnerMock.Verify(x => x.RunAll(1999, mutant, null), Times.Once); }
public void MutationTestExecutor_TimeoutShouldBePassedToProcessTimeout() { var testRunnerMock = new Mock <ITestRunner>(MockBehavior.Strict); var mutant = new Mutant { Id = 1, CoveringTests = TestsGuidList.EveryTest() }; testRunnerMock.Setup(x => x.TestMultipleMutants(It.IsAny <ITimeoutValueCalculator>(), It.IsAny <IReadOnlyList <Mutant> >(), null)). Returns(TestRunResult.TimedOut(TestsGuidList.NoTest(), TestsGuidList.NoTest(), TestsGuidList.EveryTest(), "", TimeSpan.Zero)); var target = new MutationTestExecutor(testRunnerMock.Object); var timeoutValueCalculator = new TimeoutValueCalculator(500); target.Test(new List <Mutant> { mutant }, timeoutValueCalculator, null); mutant.ResultStatus.ShouldBe(MutantStatus.Timeout); testRunnerMock.Verify(x => x.TestMultipleMutants(timeoutValueCalculator, It.IsAny <IReadOnlyList <Mutant> >(), null), Times.Once); }
public void MutationTestExecutor_FailedTestShouldBeKilled() { var testRunnerMock = new Mock <ITestRunner>(MockBehavior.Strict); testRunnerMock.Setup(x => x.SetActiveMutation(It.IsAny <int>())); testRunnerMock.Setup(x => x.RunAll(It.IsAny <int>())).Returns(new TestRunResult() { Success = false }); var mutant = new Mutant() { Id = 1 }; var target = new MutationTestExecutor(testRunnerMock.Object, 0); target.Test(mutant); mutant.ResultStatus.ShouldBe(MutantStatus.Killed); testRunnerMock.Verify(x => x.SetActiveMutation(1), Times.Once); testRunnerMock.Verify(x => x.RunAll(It.IsAny <int>()), Times.Once); }