public void Calculator_ShouldCalculateTimeoutValueNoExtra()
        {
            var target = new TimeoutValueCalculator();

            var result = target.CalculateTimeoutValue(1000, 0);

            result.ShouldBe(1500);
        }
        public void Calculator_ShouldCalculateTimeoutValue4000()
        {
            var target = new TimeoutValueCalculator();

            var result = target.CalculateTimeoutValue(4000, 2000);

            result.ShouldBe(8000);
        }
示例#3
0
        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 Calculator_ShouldCalculateTimeoutValueNoExtra(int baseTime, int extra, int expected)
        {
            var target = new TimeoutValueCalculator(extra);

            target.CalculateTimeoutValue(baseTime).ShouldBe(expected);
        }