public void Init() { base.InitBase(); project = new MockCSharpProject(); MockBuildProjectBeforeTestRun buildProject = new MockBuildProjectBeforeTestRun(); context.MockBuildProjectFactory.AddBuildProjectBeforeTestRun(buildProject); methodToTest = MockMethod.CreateMockMethodWithoutAnyAttributes(); methodToTest.FullyQualifiedName = "MyTests.MyTestClass.MyTestMethod"; classToTest = methodToTest.DeclaringType as MockClass; classToTest.SetDotNetName("MyTests.MyTestClass"); treeView = new MockTestTreeView(); treeView.SelectedProject = project; treeView.SelectedMember = methodToTest; runTestCommand.Owner = treeView; runTestCommand.Run(); buildProject.FireBuildCompleteEvent(); context.MockUnitTestWorkbench.MakeSafeThreadAsyncMethodCallsWithArguments = true; context.MockBuildOptions.ShowErrorListAfterBuild = false; TestResult result = new TestResult("MyTests.MyTestClass.MyTestMethod"); result.ResultType = TestResultType.Failure; context.MockTestResultsMonitor.FireTestFinishedEvent(result); runTestCommand.CallTestsCompleted(); }
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 Init() { base.InitBase(); project1 = new MockCSharpProject(); testProject1 = TestProjectHelper.CreateTestProjectWithTestClassAndSingleTestMethod(project1, "testClass1", "testMethod1"); project2 = new MockCSharpProject(); testProject2 = TestProjectHelper.CreateTestProjectWithTestClassAndSingleTestMethod(project1, "testClass2", "testMethod2"); context.MockUnitTestsPad.AddProject(project1); context.MockUnitTestsPad.AddProject(project2); context.MockUnitTestsPad.AddTestProject(testProject1); context.MockUnitTestsPad.AddTestProject(testProject2); buildProject1 = new MockBuildProjectBeforeTestRun(); context.MockBuildProjectFactory.AddBuildProjectBeforeTestRun(buildProject1); runTestCommand.Run(); buildProject1.FireBuildCompleteEvent(); runTestCommand.CallTestsCompleted(); }
public void Init() { base.InitBase(); project = new MockCSharpProject(); MockBuildProjectBeforeTestRun buildProject = new MockBuildProjectBeforeTestRun(); context.MockBuildProjectFactory.AddBuildProjectBeforeTestRun(buildProject); classToTest = MockClass.CreateMockClassWithoutAnyAttributes(); classToTest.SetDotNetName("MyTestClass"); treeView = new MockTestTreeView(); treeView.SelectedProject = project; treeView.SelectedClass = classToTest; runTestCommand.Owner = treeView; runTestCommand.Run(); buildProject.FireBuildCompleteEvent(); TestResult result = new TestResult("MyTestClass"); result.ResultType = TestResultType.Success; context.MockTestResultsMonitor.FireTestFinishedEvent(result); runTestCommand.CallTestsCompleted(); }
public void FireBuildCompleteEventFiresBuildCompleteEvent() { bool eventFired = false; buildProject.BuildComplete += delegate { eventFired = true; }; buildProject.FireBuildCompleteEvent(); Assert.IsTrue(eventFired); }
public void Init() { base.InitBase(); project = new MockCSharpProject(); MockBuildProjectBeforeTestRun buildProject = new MockBuildProjectBeforeTestRun(); context.MockBuildProjectFactory.AddBuildProjectBeforeTestRun(buildProject); treeView = new MockTestTreeView(); treeView.SelectedProject = project; treeView.SelectedNamespace = "MyNamespace"; runTestCommand.Owner = treeView; runTestCommand.Run(); buildProject.FireBuildCompleteEvent(); }
public void Init() { base.InitBase(); MockCSharpProject project = new MockCSharpProject(); context.MockUnitTestsPad.AddProject(project); buildProjectBeforeTestRun = new MockBuildProjectBeforeTestRun(); context.MockBuildProjectFactory.AddBuildProjectBeforeTestRun(buildProjectBeforeTestRun); runTestCommand.Run(); FileName fileName = new FileName("test.cs"); context.MockTaskService.Add(new Task(fileName, String.Empty, 1, 1, TaskType.Error)); BuildError error = new BuildError(); buildProjectBeforeTestRun.LastBuildResults.Add(error); buildProjectBeforeTestRun.FireBuildCompleteEvent(); }
public void LogStandardOutputAndErrorIsSetToFalse() { runCommand.Run(); buildProject.FireBuildCompleteEvent(); Assert.IsFalse(processRunner.LogStandardOutputAndError); }
public void BuildCompleteEventFiringDoesNotCauseTestsToRunAfterStopMethodCalled() { buildProjectBeforeTestRun.FireBuildCompleteEvent(); Assert.AreEqual(0, runTestCommand.TestRunnersCreated.Count); }