Inheritance: GuiSyncObject, IConsoleFactory
示例#1
0
        public static void Run(string filePath, DProject project, DProjectConfiguration conf)
        {
            if(manager == null)
            {
                manager = new ProgressMonitorManager();
                monitor = manager.GetOutputProgressMonitor("Run Unittest",Stock.RunProgramIcon,true,true);
            }

            Pad pad = manager.GetPadForMonitor(monitor);
            if(pad != null)
                pad.BringToFront();

            monitor.BeginTask("start unittest...",1);

            new System.Threading.Thread(delegate (){

                string[] cmdParts = GetCmdParts(project);
                string args = GetCommandArgs(cmdParts.Length >= 2 ?cmdParts[1] : "",filePath,project,conf);
                string errorOutput;
                string stdOutput;
                string execDir = GetExecDir(project,conf);

                ProjectBuilder.ExecuteCommand(cmdParts[0], args, execDir,monitor,out stdOutput, out errorOutput);

                monitor.Log.WriteLine("unittest done.");
                monitor.EndTask();
            }).Start();
        }
        protected override void Run()
        {
            IdeApp.Workbench.SaveAll();

            var doc = IdeApp.Workbench.ActiveDocument;

            var textEditorData = doc.GetContent<ITextEditorDataProvider> ().GetTextEditorData ();

            var project = IdeApp.Workspace.GetProjectContainingFile (doc.FileName);
            var targetFile = project.GetOutputFileName (project.DefaultConfiguration.Selector).FullPath;

            var sourceFile = doc.FileName;
            var lineNumber = textEditorData.Caret.Line;

            var manager = new ProgressMonitorManager();
            var build = manager.GetBuildProgressMonitor ();

            IdeApp.ProjectOperations.CurrentSelectedProject.Build(build, project.DefaultConfiguration.Selector);

            IdeApp.Workbench.StatusBar.ShowMessage("Executing specifications");

            using (var context = IdeApp.Workbench.StatusBar.CreateContext())
            {

                var kernel = new ConventionKernel ();
                var listener = new Listener ();
                var runner = new DefaultRunner (listener, new RunOptions (new string[] {  }, new string[] {  }, new string[] {}));
                kernel.Bind<ISpecificationRunner> ().ToConstant (runner);

                var executor = kernel.Get<ISpecificationsExecutor> ();
                executor.Execute (targetFile, sourceFile, lineNumber);
            }

            IdeApp.Workbench.StatusBar.ShowMessage ("Specifications executed");
        }