public override ITestRunner CreateTestRunner(TestExecutionOptions options)
		{
			if (options.UseDebugger) {
				return new MSTestDebugger(options);
			}
			return new MSTestRunner(options);
		}
		public TestProcessRunnerBaseContext(TestExecutionOptions executionOptions)
			: this(executionOptions,
				executionOptions.ProcessRunner ?? new ProcessRunner(),
				new TestResultsReader(),
				SD.FileSystem,
				SD.MessageService)
		{
		}
		public MSpecTestProcessRunnerContext(TestExecutionOptions options)
			: base(
				options,
				new ProcessRunner(),
				new MSpecUnitTestMonitor(),
				SD.FileSystem,
				SD.MessageService)
		{
		}
		public TestProcessRunnerBase(TestProcessRunnerBaseContext context)
		{
			this.executionOptions = context.ExecutionOptions;
			this.processRunner = context.TestProcessRunner;
			this.testResultsReader = context.TestResultsReader;
			this.fileSystem = context.FileSystem;
			this.messageService = context.MessageService;
			
			testResultsReader.TestFinished += OnTestFinished;
		}
		public TestProcessRunnerBaseContext(TestExecutionOptions executionOptions,
			IProcessRunner processRunner,
			ITestResultsReader testResultsMonitor,
			IFileSystem fileSystem,
			IMessageService messageService)
		{
			this.executionOptions = executionOptions;
			this.processRunner = processRunner;
			this.testResultsReader = testResultsMonitor;
			this.fileSystem = fileSystem;
			this.messageService = messageService;
		}
Exemple #6
0
		public async Task RunTestsAsync(IEnumerable<ITest> selectedTests, TestExecutionOptions options)
		{
			CancelRunningTests();
			runTestsCancellationTokenSource = new CancellationTokenSource();
			// invalidate commands as IsRunningTests changes
			System.Windows.Input.CommandManager.InvalidateRequerySuggested();
			var executionManager = new TestExecutionManager();
			try {
				await executionManager.RunTestsAsync(selectedTests, options, runTestsCancellationTokenSource.Token);
			} finally {
				runTestsCancellationTokenSource = null;
				// invalidate commands as IsRunningTests changes
				System.Windows.Input.CommandManager.InvalidateRequerySuggested();
			}
		}
		public override void Run()
		{
			ClearCodeCoverageResults();
			
			var coverageResultsReader = new CodeCoverageResultsReader();
			var options = new TestExecutionOptions {
				ModifyProcessStartInfoBeforeTestRun = (startInfo, tests) => {
					OpenCoverApplication app = CreateOpenCoverApplication(startInfo, tests);
					coverageResultsReader.AddResultsFile(app.CodeCoverageResultsFileName);
					return app.GetProcessStartInfo();
				}
			};
			
			ITestService testService = SD.GetRequiredService<ITestService>();
			IEnumerable<ITest> allTests = GetTests(testService);
			testService.RunTestsAsync(allTests, options)
				.ContinueWith(t => AfterTestsRunTask(t, coverageResultsReader))
				.FireAndForget();
		}
		public override ITestRunner CreateTestRunner(TestExecutionOptions options)
		{
			if (options.UseDebugger)
				return new NUnitTestDebugger();
			return new NUnitTestRunner(options);
		}
		public abstract ITestRunner CreateTestRunner(TestExecutionOptions options);
		public MSTestDebugger(TestExecutionOptions options)
			: base(new MSTestProcessRunnerContext(options))
		{
		}
		public NUnitTestRunner(TestExecutionOptions executionOptions)
			: this(new TestProcessRunnerBaseContext(executionOptions),
			       UnitTestingOptions.Instance.Clone())
		{
		}
		public MSpecTestRunner(TestExecutionOptions options)
			: base(new MSpecTestProcessRunnerContext(options))
		{
		}
 public abstract ITestRunner CreateTestRunner(TestExecutionOptions options);