AsyncOperation RunTest(ITreeNavigator nav, IExecutionHandler mode, bool bringToFront = true) { if (nav == null) { return(null); } UnitTest test = nav.DataItem as UnitTest; if (test == null) { return(null); } UnitTestService.ResetResult(test.RootTest); this.buttonRunAll.Sensitive = false; this.buttonStop.Sensitive = true; ExecutionContext context = new ExecutionContext(mode, IdeApp.Workbench.ProgressMonitors.ConsoleFactory, null); if (bringToFront) { IdeApp.Workbench.GetPad <TestPad> ().BringToFront(); } runningTestOperation = UnitTestService.RunTest(test, context); runningTestOperation.Task.ContinueWith(t => OnTestSessionCompleted(), TaskScheduler.FromCurrentSynchronizationContext()); return(runningTestOperation); }
protected override async Task OnExecute(MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.ExecutionContext context, ConfigurationSelector configuration) { bool defaultCanExecute; lock (canExecuteCheckLock) { try { checkingCanExecute = true; defaultCanExecute = Project.CanExecute(context, configuration); } finally { checkingCanExecute = false; } } if (defaultCanExecute) { // It is executable by default await base.OnExecute(monitor, context, configuration); return; } UnitTest test = FindRootTest(); if (test != null) { var cs = new CancellationTokenSource(); using (monitor.CancellationToken.Register(cs.Cancel)) await UnitTestService.RunTest(test, context, false, false, cs); } }
void OnRunClicked(object sender, EventArgs args) { if (rootTest == null) { return; } UnitTestService.RunTest(rootTest, null); }
protected void OnRerunTest() { UnitTest test = GetSelectedTest(); if (test == null) { return; } UnitTestService.RunTest(test, null); }
protected override async Task OnExecute(MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.ExecutionContext context, ConfigurationSelector configuration, SolutionItemRunConfiguration runConfiguration) { if (runConfiguration == unitTestingRunConfigurationInstance) { // The user selected to run the tests UnitTest test = FindRootTest(); if (test != null) { using (var cs = CancellationTokenSource.CreateLinkedTokenSource(monitor.CancellationToken)) await UnitTestService.RunTest(test, context, false, false, cs); } } else { await base.OnExecute(monitor, context, configuration, runConfiguration); } }