public void SelectedTestsHasClassConfigured() { MockTestRunner testRunner = runTestCommand.TestRunnersCreated[0]; SelectedTests tests = testRunner.SelectedTestsPassedToStartMethod; Assert.AreEqual(classToTest, tests.Class); }
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(); }
public void TestRunnersCreatedAreSaved() { MockTestRunner testRunner = runTestCommand.CallCreateTestRunner(null) as MockTestRunner; MockTestRunner[] expectedTestRunners = new MockTestRunner[] { testRunner }; Assert.AreEqual(expectedTestRunners, runTestCommand.TestRunnersCreated.ToArray()); }
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 }); }
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 }); }
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); }
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); }
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); }
public void Init() { testRunner = new MockTestRunner(); }