예제 #1
0
        protected void OnUpdateDebugTest(CommandArrayInfo info)
        {
            var debugModeSet = Runtime.ProcessService.GetDebugExecutionMode();

            if (debugModeSet == null)
            {
                return;
            }

            UnitTest test = GetSelectedTest();

            if (test == null)
            {
                return;
            }

            foreach (var mode in debugModeSet.ExecutionModes)
            {
                if (test.CanRun(mode.ExecutionHandler))
                {
                    info.Add(GettextCatalog.GetString("Debug Test ({0})", mode.Name), mode.Id);
                }
            }
            if (info.Count == 1)
            {
                info [0].Text = GettextCatalog.GetString("Debug Test");
            }
        }
        public override bool CanExecute(IBuildTarget item, ExecutionContext context, ConfigurationSelector configuration)
        {
            // We check for DefaultExecutionHandlerFactory because the tests can't run using any other execution mode

            bool res = base.CanExecute(item, context, configuration);

            if (!res && (item is IWorkspaceObject))
            {
                UnitTest test = NUnitService.Instance.FindRootTest((IWorkspaceObject)item);
                return((test != null) && test.CanRun(context.ExecutionHandler));
            }
            else
            {
                return(res);
            }
        }
        protected override bool OnGetCanExecute(MonoDevelop.Projects.ExecutionContext context, ConfigurationSelector configuration)
        {
            // We check for DefaultExecutionHandlerFactory because the tests can't run using any other execution mode

            var res = base.OnGetCanExecute(context, configuration);

            lock (canExecuteCheckLock) {
                if (checkingCanExecute)
                {
                    return(res);
                }
            }
            if (res)
            {
                return(true);
            }
            UnitTest test = FindRootTest();

            return((test != null) && test.CanRun(context.ExecutionHandler));
        }
                void RunTest(UnitTest test)
                {
                    var debugModeSet = Runtime.ProcessService.GetDebugExecutionMode();

                    MonoDevelop.Core.Execution.IExecutionHandler ctx = null;
                    if (debug && debugModeSet != null)
                    {
                        foreach (var executionMode in debugModeSet.ExecutionModes)
                        {
                            if (test.CanRun(executionMode.ExecutionHandler))
                            {
                                ctx = executionMode.ExecutionHandler;
                                break;
                            }
                        }
                    }
                    // NUnitService.Instance.RunTest (test, ctx);
                    var pad     = IdeApp.Workbench.GetPad <TestPad> ();
                    var content = (TestPad)pad.Content;

                    content.RunTest(test, ctx);
                }
				void RunTest (UnitTest test)
				{
					var debugModeSet = Runtime.ProcessService.GetDebugExecutionMode ();
					MonoDevelop.Core.Execution.IExecutionHandler ctx = null;
					if (debug && debugModeSet != null) {
						foreach (var executionMode in debugModeSet.ExecutionModes) {
							if (test.CanRun (executionMode.ExecutionHandler)) {
								ctx = executionMode.ExecutionHandler;
								break;
							}
						}
					}

					var pad = IdeApp.Workbench.GetPad<TestPad> ();
					var content = (TestPad)pad.Content;
					content.RunTest (test, ctx);
				}
				void RunTest (UnitTest test)
				{
					NUnitService.ResetResult (test.RootTest);
					var debugModeSet = Runtime.ProcessService.GetDebugExecutionMode ();
					MonoDevelop.Core.Execution.IExecutionHandler ctx = null;
					if (debug && debugModeSet != null) {
						foreach (var executionMode in debugModeSet.ExecutionModes) {
							if (test.CanRun (executionMode.ExecutionHandler)) {
								ctx = executionMode.ExecutionHandler;
								break;
							}
						}
					}
					NUnitService.Instance.RunTest (test, ctx).Completed += delegate {
						Application.Invoke (delegate {
							doc.Editor.Parent.QueueDraw ();
						});
					};
				}