Exemple #1
0
        async void OnDebugAllClicked(object sender, EventArgs args)
        {
            var nav = TreeView.GetRootNode();

            if (nav == null)
            {
                return;
            }

            var testGroup = nav.DataItem as UnitTestGroup;
            var tests     = testGroup.Tests;

            if (tests == null)
            {
                return;
            }

            var debugModeSet = Runtime.ProcessService.GetDebugExecutionMode();

            if (debugModeSet == null)
            {
                return;
            }

            this.buttonRunAll.Sensitive   = false;
            this.buttonDebugAll.Sensitive = false;
            this.buttonStop.Sensitive     = true;

            foreach (UnitTest test in tests)
            {
                foreach (var mode in debugModeSet.ExecutionModes)
                {
                    if (test.CanRun(mode.ExecutionHandler))
                    {
                        ExecutionContext context = new ExecutionContext(mode.ExecutionHandler, IdeApp.Workbench.ProgressMonitors.ConsoleFactory, null);
                        await UnitTestService.RunTests(new UnitTest [] { test }, context, true).Task;

                        continue;
                    }
                }
            }

            OnTestSessionCompleted();
        }
Exemple #2
0
        AsyncOperation RunTests(IEnumerable <UnitTest> tests, IExecutionHandler mode, bool bringToFront)
        {
            foreach (var test in tests)
            {
                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.RunTests(tests, context);
            runningTestOperation.Task.ContinueWith(t => OnTestSessionCompleted(), TaskScheduler.FromCurrentSynchronizationContext());
            return(runningTestOperation);
        }