예제 #1
0
        public void InitialTestProcess_ShouldCalculateTestTimeout()
        {
            var testRunnerMock = new Mock<ITestRunner>(MockBehavior.Strict);
            testRunnerMock.Setup(x => x.RunAll(It.IsAny<int?>(), It.IsAny<int?>())).Returns(new TestRunResult { Success = true });
            testRunnerMock.Setup(x => x.CaptureCoverage())
                .Returns(new TestRunResult { Success = true });
            testRunnerMock.Setup(x => x.DiscoverNumberOfTests()).Returns(0);

            var result = _target.InitialTest(testRunnerMock.Object);
        }
        public void InitialTestProcess_ShouldThrowExceptionOnFail()
        {
            var testRunnerMock = new Mock <ITestRunner>(MockBehavior.Strict);

            testRunnerMock.Setup(x => x.RunAll(It.IsAny <int?>(), null, null)).Returns(new TestRunResult(false));
            testRunnerMock.Setup(x => x.CaptureCoverage(It.IsAny <List <Mutant> >(), false, false))
            .Returns(new TestRunResult(true));
            testRunnerMock.Setup(x => x.DiscoverNumberOfTests()).Returns(1);

            var exception = Assert.Throws <StrykerInputException>(() => _target.InitialTest(testRunnerMock.Object));
        }
        public void InitialTestProcess_ShouldThrowExceptionOnFail()
        {
            var testRunnerMock = new Mock <ITestRunner>(MockBehavior.Strict);
            var failedTest     = Guid.NewGuid();
            var successfulTest = Guid.NewGuid();
            var ranTests       = new TestsGuidList(failedTest, successfulTest);
            var failedTests    = new TestsGuidList(failedTest);

            testRunnerMock.Setup(x => x.InitialTest()).Returns(new TestRunResult(ranTests, failedTests, TestsGuidList.NoTest(), string.Empty, TimeSpan.Zero));
            testRunnerMock.Setup(x => x.CaptureCoverage(It.IsAny <List <Mutant> >()))
            .Returns(new TestRunResult(true));
            testRunnerMock.Setup(x => x.DiscoverTests()).Returns(new TestSet());

            Assert.Throws <InputException>(() => _target.InitialTest(_options, testRunnerMock.Object));
        }