コード例 #1
0
        public void SelectedTestsHasClassConfigured()
        {
            MockTestRunner testRunner = runTestCommand.TestRunnersCreated[0];
            SelectedTests  tests      = testRunner.SelectedTestsPassedToStartMethod;

            Assert.AreEqual(classToTest, tests.Class);
        }
コード例 #2
0
        public void Init()
        {
            base.InitBase();

            project = new MockCSharpProject();
            context.MockUnitTestsPad.AddProject(project);

            string[] methodNames = new string[] { "FirstTest", "SecondTest", "ThirdTest" };

            testProject =
                TestProjectHelper.CreateTestProjectWithTestClassTestMethods(project,
                                                                            "MyTests.MyTestClass",
                                                                            methodNames);

            TestClass testClass = testProject.TestClasses[0];

            firstTestMethod  = testClass.TestMethods[0];
            secondTestMethod = testClass.TestMethods[1];
            thirdTestMethod  = testClass.TestMethods[2];

            context.MockUnitTestsPad.AddTestProject(testProject);

            MockBuildProjectBeforeTestRun buildProjectBeforeTestRun = new MockBuildProjectBeforeTestRun();

            context.MockBuildProjectFactory.AddBuildProjectBeforeTestRun(buildProjectBeforeTestRun);

            context.UnitTestingOptions.NoThread            = true;
            context.UnitTestingOptions.NoShadow            = true;
            context.UnitTestingOptions.NoLogo              = true;
            context.UnitTestingOptions.NoDots              = true;
            context.UnitTestingOptions.Labels              = true;
            context.UnitTestingOptions.CreateXmlOutputFile = true;

            testFramework = new MockTestFramework();
            context.MockRegisteredTestFrameworks.AddTestFrameworkForProject(project, testFramework);

            runTestCommand.Run();

            buildProjectBeforeTestRun.FireBuildCompleteEvent();

            errorTestResult            = new TestResult("MyTests.MyTestClass.FirstTest");
            errorTestResult.ResultType = TestResultType.Failure;

            warningTestResult            = new TestResult("MyTests.MyTestClass.SecondTest");
            warningTestResult.ResultType = TestResultType.Ignored;

            successTestResult            = new TestResult("MyTests.MyTestClass.ThirdTest");
            successTestResult.ResultType = TestResultType.Success;

            context.MockUnitTestWorkbench.MakeSafeThreadAsyncMethodCallsWithArguments = true;
            MockTestRunner testRunner = runTestCommand.TestRunnersCreated[0];

            testRunner.FireTestFinishedEvent(errorTestResult);
            testRunner.FireTestFinishedEvent(warningTestResult);
            testRunner.FireTestFinishedEvent(successTestResult);

            context.MockUnitTestsPad.IsUpdateToolbarMethodCalled = false;
            runningTestsBeforeTestsFinishedCalled = AbstractRunTestCommand.IsRunningTest;
            runTestCommand.CallTestsCompleted();
        }
コード例 #3
0
        public void TestRunnersCreatedAreSaved()
        {
            MockTestRunner testRunner = runTestCommand.CallCreateTestRunner(null) as MockTestRunner;

            MockTestRunner[] expectedTestRunners = new MockTestRunner[] { testRunner };
            Assert.AreEqual(expectedTestRunners, runTestCommand.TestRunnersCreated.ToArray());
        }
コード例 #4
0
 protected void Given_a_fully_tested_app_in_which_no_mutants_will_survive()
 {
     MockTestRunner.Setup(x => x.RunTests(It.IsAny <IEnumerable <string> >(), It.IsAny <IEnumerable <string> >()))
     .Returns(new TestRunResult {
         Status = TestRunStatus.SomeTestsFailed
     });
 }
コード例 #5
0
 protected void Given_a_partially_tested_app_in_which_multiple_mutants_survive_for_a_syntax_node()
 {
     MockTestRunner.Setup(x => x.RunTests(It.IsAny <IEnumerable <string> >(), It.IsAny <IEnumerable <string> >()))
     .Returns(new TestRunResult {
         Status = TestRunStatus.AllTestsPassed
     });
 }
コード例 #6
0
        protected void Given_a_partially_tested_app_in_which_a_mutant_will_survive()
        {
            var wasCalled = false;

            Func <TestRunResult> returnValueFunction = () =>
            {
                if (!wasCalled)
                {
                    wasCalled = true;
                    return(new TestRunResult {
                        Status = TestRunStatus.AllTestsPassed
                    });
                }

                return(new TestRunResult {
                    Status = TestRunStatus.SomeTestsFailed
                });
            };

            MockTestRunner.Setup(x => x.RunAllTests(It.IsAny <IEnumerable <string> >()))
            .Returns(returnValueFunction);

            MockTestRunner.Setup(x => x.RunTests(It.IsAny <IEnumerable <string> >(), It.IsAny <IEnumerable <string> >()))
            .Returns(returnValueFunction);
        }
コード例 #7
0
ファイル: Coverage_analysis.cs プロジェクト: tiggerite/fettle
        public void Then_all_tests_are_run()
        {
            MockTestRunner.Verify(r => r.RunAllTests(It.IsAny <IEnumerable <string> >()));

            MockTestRunner.Verify(r => r.RunTests(
                                      It.IsAny <IEnumerable <string> >(),
                                      It.IsAny <IEnumerable <string> >()),
                                  Times.Never);
        }
コード例 #8
0
ファイル: Coverage_analysis.cs プロジェクト: tiggerite/fettle
        public void Then_only_tests_that_cover_members_are_run()
        {
            MockTestRunner.Verify(r => r.RunTests(
                                      It.IsAny <IEnumerable <string> >(),
                                      It.Is <IEnumerable <string> >(tn =>
                                                                    tn.Contains("example.test.one"))));

            MockTestRunner.Verify(r => r.RunTests(
                                      It.IsAny <IEnumerable <string> >(),
                                      It.Is <IEnumerable <string> >(tn =>
                                                                    !tn.Contains("example.test.one"))),
                                  Times.Never);

            MockTestRunner.Verify(r => r.RunAllTests(
                                      It.IsAny <IEnumerable <string> >()),
                                  Times.Never);
        }
コード例 #9
0
 public void Init()
 {
     testRunner = new MockTestRunner();
 }