• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# VisualStudioTools.VisualStudioApp类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.VisualStudioTools.VisualStudioApp的典型用法代码示例。如果您正苦于以下问题:C# VisualStudioApp类的具体用法?C# VisualStudioApp怎么用?C# VisualStudioApp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VisualStudioApp类属于Microsoft.VisualStudioTools命名空间,在下文中一共展示了VisualStudioApp类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ActivateInteractiveWindow

        public override ToolWindowPane ActivateInteractiveWindow(VisualStudioApp app, string executionMode) {
            string description = null;
            if (Version.IsCPython) {
                description = string.Format("{0} {1}",
                    Version.Isx64 ? "Python 64-bit" : "Python 32-bit",
                    Version.Version.ToVersion()
                );
            } else if (Version.IsIronPython) {
                description = string.Format("{0} {1}",
                    Version.Isx64 ? "IronPython 64-bit" : "IronPython",
                    Version.Version.ToVersion()
                );
            }
            Assert.IsNotNull(description, "Unknown interpreter");

            var automation = (IVsPython)app.Dte.GetObject("VsPython");
            var options = (IPythonOptions)automation;
            var replOptions = options.Interactive;
            Assert.IsNotNull(replOptions, "Could not find options for " + description);

            var oldAddNewLineAtEndOfFullyTypedWord = options.Intellisense.AddNewLineAtEndOfFullyTypedWord;
            app.OnDispose(() => options.Intellisense.AddNewLineAtEndOfFullyTypedWord = oldAddNewLineAtEndOfFullyTypedWord);
            options.Intellisense.AddNewLineAtEndOfFullyTypedWord = AddNewLineAtEndOfFullyTypedWord;

            var interpreters = app.ComponentModel.GetService<IInterpreterRegistryService>();
            var replId = PythonReplEvaluatorProvider.GetEvaluatorId(
                interpreters.FindConfiguration(Version.Id)
            );

            return app.ServiceProvider.GetUIThread().Invoke(() => {
                var provider = app.ComponentModel.GetService<InteractiveWindowProvider>();
                return (ToolWindowPane)provider.OpenOrCreate(replId);
            });
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:34,代码来源:PythonReplWindowProxySettings.cs


示例2: FromProcessId

 public static VisualStudioApp FromProcessId(int processId) {
     VisualStudioApp inst;
     lock (_knownInstances) {
         if (!_knownInstances.TryGetValue(processId, out inst)) {
             _knownInstances[processId] = inst = new VisualStudioApp(processId);
         }
     }
     return inst;
 }
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:9,代码来源:VisualStudioApp.cs


示例3: OpenProject

        internal void OpenProject(VisualStudioApp app, string slnName, out PythonProjectNode projectNode, out EnvDTE.Project dteProject) {
            PythonVersion.AssertInstalled();

            dteProject = app.OpenProject("TestData\\Targets\\" + slnName);
            projectNode = dteProject.GetPythonProject();
            var fact = projectNode.InterpreterFactories.Where(x => x.Configuration.Id == PythonVersion.Id).FirstOrDefault();
            Assert.IsNotNull(fact, "Project does not contain expected interpreter");
            projectNode.ActiveInterpreter = fact;
            dteProject.Save();
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:10,代码来源:BuildTasksUITests.cs


示例4: CreateTemporaryProject

        private EnvDTE.Project CreateTemporaryProject(VisualStudioApp app) {
            var project = app.CreateProject(
                PythonVisualStudioApp.TemplateLanguageName,
                PythonVisualStudioApp.PythonApplicationTemplate,
                TestData.GetTempPath(),
                TestContext.TestName
            );

            Assert.IsNotNull(project, "Project was not created");
            return project;
        }
开发者ID:KaushikCh,项目名称:PTVS,代码行数:11,代码来源:VirtualEnvTests.cs


示例5: TestNpmUIInitialization

        public void TestNpmUIInitialization() {
            using (var app = new VisualStudioApp()) {
                // Initialize call is required because NTVS does not autoload its package
                // We may not be on UI thread, but Dev11 and Dev12 know how to sort that out.
                app.ServiceProvider.GetUIThread().Invoke(() => {
                    NpmPackageInstallWindow npmWindow = OpenNpmWindowAndWaitForReady();

                    Assert.IsTrue(npmWindow.FilterTextBox.IsKeyboardFocused, "FilterTextBox should be keyboard focused");
                    Assert.AreEqual(0, npmWindow._packageList.SelectedIndex, "First item in package list should be selected");
                });
            }
        }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:12,代码来源:NpmUITests.cs


示例6: NpmUIArrowKeyBehavior

        public void NpmUIArrowKeyBehavior()
        {
            using (var app = new VisualStudioApp()) {
                app.ServiceProvider.GetUIThread().Invoke(() => {
                    NpmPackageInstallWindow npmWindow = OpenNpmWindowAndWaitForReady();

                    System.Windows.Input.Keyboard.Focus(npmWindow.FilterTextBox);
                    TestUtilities.UI.Keyboard.PressAndRelease(Key.Down);
                    WaitForUIInputIdle();

                    var selectedItem = GetSelectedPackageListItemContainer(npmWindow);
                    Assert.IsTrue(selectedItem.IsKeyboardFocused, "Focus should be on newly selected item");
                    Assert.AreEqual(0, npmWindow._packageList.SelectedIndex);

                    TestUtilities.UI.Keyboard.PressAndRelease(Key.Down);
                    WaitForUIInputIdle();

                    Assert.AreEqual(1, npmWindow._packageList.SelectedIndex);

                    npmWindow.FilterTextBox.Focus();
                    TestUtilities.UI.Keyboard.PressAndRelease(Key.Up);
                    WaitForUIInputIdle();

                    Assert.IsTrue(npmWindow.FilterTextBox.IsKeyboardFocused, "Focus should remain on filter box");
                    Assert.AreEqual(1, npmWindow._packageList.SelectedIndex, "Pressing up while in filter box should maintain current selection");

                    selectedItem = GetSelectedPackageListItemContainer(npmWindow);
                    selectedItem.Focus();
                    TestUtilities.UI.Keyboard.PressAndRelease(Key.Up);
                    TestUtilities.UI.Keyboard.PressAndRelease(Key.Up);
                    WaitForUIInputIdle();

                    Assert.IsTrue(npmWindow.FilterTextBox.IsKeyboardFocused, "Focus should move to filter textbox after pressing up key while on topmost package is selected");

                    TestUtilities.UI.Keyboard.PressAndRelease(Key.Up);
                    WaitForUIInputIdle();

                    Assert.IsTrue(npmWindow.FilterTextBox.IsKeyboardFocused, "Focus should remain on textbox while pressing up when topmost package is selected");
                    Assert.IsFalse(npmWindow.InstallButton.IsEnabled, "Install button should not be enabled when filter box has focus");

                    TestUtilities.UI.Keyboard.PressAndRelease(Key.Enter);
                    WaitForUIInputIdle();

                    selectedItem = GetSelectedPackageListItemContainer(npmWindow);
                    Assert.IsTrue(selectedItem.IsKeyboardFocused, "Focus should be on newly selected item");
                    Assert.AreEqual(0, npmWindow._packageList.SelectedIndex);
                });
            }
        }
开发者ID:xeronith,项目名称:nodejstools,代码行数:49,代码来源:NpmUITests.cs


示例7: FromCommandLineArgs

 public static VisualStudioApp FromCommandLineArgs(string[] commandLineArgs) {
     for (int i = 0; i < commandLineArgs.Length - 1; ++i) {
         int processId;
         if (commandLineArgs[i].Equals("/parentProcessId", StringComparison.InvariantCultureIgnoreCase) &&
             int.TryParse(commandLineArgs[i + 1], out processId)) {
             VisualStudioApp inst;
             lock (_knownInstances) {
                 if (!_knownInstances.TryGetValue(processId, out inst)) {
                     _knownInstances[processId] = inst = new VisualStudioApp(processId);
                 }
             }
             return inst;
         }
     }
     return null;
 }
开发者ID:sramos30,项目名称:ntvsiot,代码行数:16,代码来源:VisualStudioApp.cs


示例8: NewDjangoProject

 public void NewDjangoProject() {
     using (var app = new VisualStudioApp()) {
         var project = app.CreateProject(
             PythonVisualStudioApp.TemplateLanguageName,
             PythonVisualStudioApp.DjangoWebProjectTemplate,
             TestData.GetTempPath(),
             "NewDjangoProject"
         );
         var folder = project.ProjectItems.Item(project.Name);
         Assert.IsNotNull(project.ProjectItems.Item("manage.py"));
         Assert.IsNotNull(folder.ProjectItems.Item("settings.py"));
         Assert.IsNotNull(folder.ProjectItems.Item("urls.py"));
         Assert.IsNotNull(folder.ProjectItems.Item("__init__.py"));
         Assert.IsNotNull(folder.ProjectItems.Item("wsgi.py"));
     }
 }
开发者ID:smallwave,项目名称:PTVS,代码行数:16,代码来源:DjangoProjectTests.cs


示例9: NewDjangoProjectSafeProjectName

        public void NewDjangoProjectSafeProjectName() {
            using (var app = new VisualStudioApp()) {
                var project = app.CreateProject(
                    PythonVisualStudioApp.TemplateLanguageName,
                    PythonVisualStudioApp.DjangoWebProjectTemplate,
                    TestData.GetTempPath(),
                    "Django Project $100"
                );

                var folder = project.ProjectItems.Item("Django_Project__100");
                Assert.IsNotNull(project.ProjectItems.Item("manage.py"));
                Assert.IsNotNull(folder.ProjectItems.Item("settings.py"));
                Assert.IsNotNull(folder.ProjectItems.Item("urls.py"));
                Assert.IsNotNull(folder.ProjectItems.Item("__init__.py"));
                Assert.IsNotNull(folder.ProjectItems.Item("wsgi.py"));
                var settings = app.ServiceProvider.GetUIThread().Invoke(() => project.GetPythonProject().GetProperty("DjangoSettingsModule"));
                Assert.AreEqual("Django_Project__100.settings", settings);
            }
        }
开发者ID:smallwave,项目名称:PTVS,代码行数:19,代码来源:DjangoProjectTests.cs


示例10: TestAttachBasic

        public void TestAttachBasic() {

            string debugSolution = TestData.GetPath(@"TestData\DebugAttach\DebugAttach.sln");
            string startFile = "Simple.py";


            using (var app = new VisualStudioApp()) {
                var dbg2 = (Debugger2)app.Dte.Debugger;
                SD.Process processToAttach = OpenSolutionAndLaunchFile(app, debugSolution, startFile, "", "");

                try {
                    AttachAndWaitForMode(app, processToAttach, AD7Engine.DebugEngineName, dbgDebugMode.dbgRunMode);
                } finally {
                    dbg2.DetachAll();
                    DebugProject.WaitForMode(app, dbgDebugMode.dbgDesignMode);
                    if (!processToAttach.HasExited) processToAttach.Kill();
                }
            }
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:19,代码来源:AttachTest.cs


示例11: CustomCommandsAdded

        public void CustomCommandsAdded() {
            using (var app = new VisualStudioApp()) {
                PythonProjectNode node;
                EnvDTE.Project proj;
                OpenProject(app, "Commands1.sln", out node, out proj);

                AssertUtil.ContainsExactly(
                    node._customCommands.Select(cc => cc.DisplayLabel),
                    "Test Command 1",
                    "Test Command 2"
                );

                app.OpenSolutionExplorer().FindItem("Solution 'Commands1' (1 project)", "Commands1").Select();

                var menuBar = app.FindByAutomationId("MenuBar").AsWrapper();
                Assert.IsNotNull(menuBar, "Unable to find menu bar");
                var projectMenu = menuBar.FindByName("Project").AsWrapper();
                Assert.IsNotNull(projectMenu, "Unable to find Project menu");
                projectMenu.Element.EnsureExpanded();

                try {
                    foreach (var name in node._customCommands.Select(cc => cc.DisplayLabelWithoutAccessKeys)) {
                        Assert.IsNotNull(projectMenu.FindByName(name), name + " not found");
                    }
                } finally {
                    try {
                        // Try really really hard to collapse and deselect the
                        // Project menu, since VS will keep it selected and it
                        // may not come back for some reason...
                        projectMenu.Element.Collapse();
                        Keyboard.PressAndRelease(System.Windows.Input.Key.Escape);
                        Keyboard.PressAndRelease(System.Windows.Input.Key.Escape);
                    } catch {
                        // ...but don't try so hard that we fail if we can't 
                        // simulate keypresses.
                    }
                }
            }
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:39,代码来源:BuildTasksUITests.cs


示例12: AutoBraceCompetionTest

        private static void AutoBraceCompetionTest(VisualStudioApp app, Project project, string typedText, string expectedText) {
            var item = project.ProjectItems.Item("Program.py");
            var window = item.Open();
            window.Activate();

            Keyboard.Type(typedText);

            var doc = app.GetDocument(item.Document.FullName);

            string actual = null;
            for (int i = 0; i < 100; i++) {
                actual = doc.TextView.TextBuffer.CurrentSnapshot.GetText();

                if (expectedText == actual) {
                    break;
                }
                System.Threading.Thread.Sleep(100);
            }

            Assert.AreEqual(expectedText, actual);

            window.Document.Close(vsSaveChanges.vsSaveChangesNo);
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:23,代码来源:EditorTests.cs


示例13: AddReferenceAndBuild

        public void AddReferenceAndBuild()
        {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\ProjectReference.sln");

                TargetInfo ti = TargetInfo.GetTargetInfo();

                // Wait for solution to load...
                for (int i = 0; i < 40 && app.Dte.Solution.Projects.Count == 0; i++) {
                    System.Threading.Thread.Sleep(250);
                }

                Assert.IsFalse(0 == app.Dte.Solution.Projects.Count);

                // Set platform
                foreach (SolutionConfiguration2 solConfiguration2 in app.Dte.Solution.SolutionBuild.SolutionConfigurations) {
                    if (String.Equals(solConfiguration2.PlatformName, ti.Plat, StringComparison.Ordinal)) {
                        solConfiguration2.Activate();
                        break;
                    }
                }

                // Build project
                app.Dte.Solution.SolutionBuild.Build(true);

                // Check for C# reference in the appxrecipe file
                string appxRecipePath = string.Format("{0}\\TestData\\ProjectReference\\bin\\{1}\\Debug\\ProjectReference.build.appxrecipe",
                    Directory.GetCurrentDirectory(), ti.Plat);

                Assert.AreEqual(true, File.Exists(appxRecipePath), string.Format("ProjectReference.build.appxrecipe is missing from bin output folder"));

                string appxRecipeStr = File.ReadAllText(appxRecipePath);

                Assert.IsTrue(appxRecipeStr.Contains("CSComponent"));
            }
        }
开发者ID:munyirik,项目名称:ntvsiot,代码行数:36,代码来源:ReferenceTests.cs


示例14: CloudProjectTest

        private static void CloudProjectTest(string roleType, bool openServiceDefinition) {
            Assert.IsTrue(roleType == "Web" || roleType == "Worker", "Invalid roleType: " + roleType);

            using (var app = new VisualStudioApp())
            using (FileUtils.Backup(TestData.GetPath(@"TestData\CloudProject\CloudProject\ServiceDefinition.csdef"))) {
                app.OpenProject("TestData\\CloudProject.sln", expectedProjects: 3);

                var ccproj = app.Dte.Solution.Projects.Cast<EnvDTE.Project>().FirstOrDefault(p => p.Name == "CloudProject");
                Assert.IsNotNull(ccproj);

                if (openServiceDefinition) {
                    var wnd = ccproj.ProjectItems.Item("ServiceDefinition.csdef").Open();
                    wnd.Activate();
                    app.OnDispose(() => wnd.Close());
                }

                IVsHierarchy hier;
                var sln = app.GetService<IVsSolution>(typeof(SVsSolution));
                ErrorHandler.ThrowOnFailure(sln.GetProjectOfUniqueName(ccproj.FullName, out hier));

                app.ServiceProvider.GetUIThread().Invoke(() =>
                    NodejsProject.UpdateServiceDefinition(
                        hier,
                        roleType,
                        roleType + "Role1",
                        new ServiceProvider((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)app.Dte)
                    )
                );

                var doc = new XmlDocument();
                for (int retries = 5; retries > 0; --retries) {
                    try {
                        doc.Load(TestData.GetPath(@"TestData\CloudProject\CloudProject\ServiceDefinition.csdef"));
                        break;
                    } catch (IOException ex) {
                        Console.WriteLine("Exception while reading ServiceDefinition.csdef.{0}{1}", Environment.NewLine, ex);
                    } catch (XmlException) {
                        var copyTo = TestData.GetPath(@"TestData\CloudProject\CloudProject\" + Path.GetRandomFileName());
                        File.Copy(TestData.GetPath(@"TestData\CloudProject\CloudProject\ServiceDefinition.csdef"), copyTo);
                        Console.WriteLine("Copied file to " + copyTo);
                        throw;
                    }
                    Thread.Sleep(100);
                }
                var ns = new XmlNamespaceManager(doc.NameTable);
                ns.AddNamespace("sd", "http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition");
                doc.Save(Console.Out);

                var nav = doc.CreateNavigator();
                if (roleType == "Web") {
                    Assert.IsNotNull(nav.SelectSingleNode(
                        "/sd:ServiceDefinition/sd:WebRole[@name='WebRole1']/sd:Startup/sd:Task[@commandLine='setup_web.cmd > log.txt']",
                        ns
                    ));
                } else if (roleType == "Worker") {
                    Assert.IsNotNull(nav.SelectSingleNode(
                        "/sd:ServiceDefinition/sd:WorkerRole[@name='WorkerRole1']/sd:Startup/sd:Task[@commandLine='setup_worker.cmd > log.txt']",
                        ns
                    ));
                    Assert.IsNotNull(nav.SelectSingleNode(
                        "/sd:ServiceDefinition/sd:WorkerRole[@name='WorkerRole1']/sd:Runtime/sd:EntryPoint/sd:ProgramEntryPoint[@commandLine='node.cmd .\\server.js']",
                        ns
                    ));
                }
            }
        }
开发者ID:raphaelivo,项目名称:nodejstools,代码行数:66,代码来源:AzureProjectTests.cs


示例15: ErrorListAndTaskListAreClearedWhenProjectWithMultipleFilesIsUnloaded

        public void ErrorListAndTaskListAreClearedWhenProjectWithMultipleFilesIsUnloaded() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\ErrorProjectMultipleFiles.sln");

                app.WaitForTaskListItems(typeof(SVsErrorList), 14);
                app.WaitForTaskListItems(typeof(SVsTaskList), 4);

                var solutionService = app.GetService<IVsSolution>(typeof(SVsSolution));
                Assert.IsNotNull(solutionService);

                IVsHierarchy selectedHierarchy;
                ErrorHandler.ThrowOnFailure(solutionService.GetProjectOfUniqueName(project.UniqueName, out selectedHierarchy));
                Assert.IsNotNull(selectedHierarchy);

                Console.WriteLine("Unloading project");
                ErrorHandler.ThrowOnFailure(solutionService.CloseSolutionElement((uint)__VSSLNCLOSEOPTIONS.SLNCLOSEOPT_UnloadProject, selectedHierarchy, 0));

                app.WaitForTaskListItems(typeof(SVsErrorList), 0);
                app.WaitForTaskListItems(typeof(SVsTaskList), 0);
            }
        }
开发者ID:RussBaz,项目名称:PTVS,代码行数:21,代码来源:ErrorListTaskListTests.cs


示例16: TaskListTest

        internal void TaskListTest(VisualStudioApp app, Type taskListService, IList<TaskItemInfo> expectedItems, int[] navigateTo = null) {
            var items = app.WaitForTaskListItems(taskListService, expectedItems.Count);
            var actualItems = items.Select(item => new TaskItemInfo(item)).ToList();

            Assert.AreEqual(expectedItems.Count, actualItems.Count);
            AssertUtil.ContainsExactly(actualItems, expectedItems.ToSet());

            if (navigateTo != null) {
                foreach (var i in navigateTo) {
                    Console.WriteLine("Trying to navigate to " + expectedItems[i]);

                    var j = actualItems.IndexOf(expectedItems[i]);
                    Assert.IsTrue(j >= 0);
                    app.ServiceProvider.GetUIThread().Invoke((Action)delegate { items[j].NavigateTo(); });

                    var doc = app.Dte.ActiveDocument;
                    Assert.IsNotNull(doc);
                    Assert.AreEqual(expectedItems[i].Document, doc.FullName);

                    var textDoc = (EnvDTE.TextDocument)doc.Object("TextDocument");
                    Assert.AreEqual(expectedItems[i].Line + 1, textDoc.Selection.ActivePoint.Line);
                    Assert.AreEqual(expectedItems[i].Column + 1, textDoc.Selection.ActivePoint.DisplayColumn);
                }
            }
        }
开发者ID:RussBaz,项目名称:PTVS,代码行数:25,代码来源:ErrorListTaskListTests.cs


示例17: TestNpmUITabKeyBehavior

        public void TestNpmUITabKeyBehavior() {
            using (var app = new VisualStudioApp()) {
                app.ServiceProvider.GetUIThread().Invoke(() => {
                    NpmPackageInstallWindow npmWindow = OpenNpmWindowAndWaitForReady();

                    npmWindow.FilterTextBox.Focus();
                    WaitForUIInputIdle();

                    TestUtilities.UI.Keyboard.PressAndRelease(Key.Tab);
                    WaitForUIInputIdle();

                    var selectedItem = GetSelectedPackageListItemContainer(npmWindow);
                    Assert.IsTrue(selectedItem.IsKeyboardFocused);

                    // Install button disabled, must key down to select "installable" package
                    TestUtilities.UI.Keyboard.PressAndRelease(Key.Down);
                    TestUtilities.UI.Keyboard.PressAndRelease(Key.Tab);
                    WaitForUIInputIdle();

                    Assert.IsTrue(npmWindow.DependencyComboBox.IsKeyboardFocused);

                    TestUtilities.UI.Keyboard.PressAndRelease(Key.Tab);
                    WaitForUIInputIdle();

                    Assert.IsTrue(npmWindow.SaveToPackageJsonCheckbox.IsKeyboardFocused);

                    TestUtilities.UI.Keyboard.PressAndRelease(Key.Tab);
                    WaitForUIInputIdle();

                    Assert.IsTrue(npmWindow.SelectedVersionComboBox.IsKeyboardFocused);

                    TestUtilities.UI.Keyboard.PressAndRelease(Key.Tab);
                    WaitForUIInputIdle();

                    Assert.IsTrue(npmWindow.ArgumentsTextBox.IsKeyboardFocused);

                    TestUtilities.UI.Keyboard.PressAndRelease(Key.Tab);
                    WaitForUIInputIdle();

                    Assert.IsTrue(npmWindow.InstallButton.IsKeyboardFocused);
                });
            }
        }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:43,代码来源:NpmUITests.cs


示例18: DjangoProjectWithSubdirectory

        public void DjangoProjectWithSubdirectory() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject("TestData\\DjangoProjectWithSubDirectory.sln");

                var pyProj = (IPythonProject2)project.GetPythonProject();
                var dsm = pyProj.Site.GetUIThread().Invoke(() => pyProj.GetProperty("DjangoSettingsModule"));
                Assert.AreEqual("config.settings", dsm);
                var workDir = pyProj.Site.GetUIThread().Invoke(() => pyProj.GetWorkingDirectory()).TrimEnd('\\');
                Assert.AreEqual(TestData.GetPath("TestData\\DjangoProjectWithSubDirectory\\project"), workDir, true);

                var cmd = pyProj.FindCommand("DjangoCollectStaticCommand");

                pyProj.Site.GetUIThread().Invoke(() => {
                    Assert.IsTrue(cmd.CanExecute(pyProj), "Cannot execute DjangoCollectStaticCommand");
                    cmd.Execute(pyProj);
                });

                // The static dir is 'test_static', check that the admin files
                // are copied into there.
                Assert.IsTrue(Directory.Exists(Path.Combine(workDir, "test_static", "admin")), "admin static directory was not created");
                Assert.IsTrue(File.Exists(Path.Combine(workDir, "test_static", "admin", "css", "base.css")), "admin static files were not copied");
            }
        }
开发者ID:smallwave,项目名称:PTVS,代码行数:23,代码来源:DjangoProjectTests.cs


示例19: RunTestCase

        private void RunTestCase(VisualStudioApp app, IFrameworkHandle frameworkHandle, IRunContext runContext, TestCase test, Dictionary<string, NodejsProjectSettings> sourceToSettings) {
            var testResult = new TestResult(test);
            frameworkHandle.RecordStart(test);
            testResult.StartTime = DateTimeOffset.Now;
            NodejsProjectSettings settings;
            if (!sourceToSettings.TryGetValue(test.Source, out settings)) {
                sourceToSettings[test.Source] = settings = LoadProjectSettings(test.Source);
            }
            if (settings == null) {
                frameworkHandle.SendMessage(
                    TestMessageLevel.Error,
                    "Unable to determine interpreter to use for " + test.Source);
                RecordEnd(
                    frameworkHandle,
                    test,
                    testResult,
                    null,
                    "Unable to determine interpreter to use for " + test.Source,
                    TestOutcome.Failed);
                return;
            }

            NodejsTestInfo testInfo = new NodejsTestInfo(test.FullyQualifiedName);
            List<string> args = new List<string>();
            int port = 0;
            if (runContext.IsBeingDebugged && app != null) {
                app.GetDTE().Debugger.DetachAll();
                args.AddRange(GetDebugArgs(settings, out port));
            }

            var workingDir = Path.GetDirectoryName(CommonUtils.GetAbsoluteFilePath(settings.WorkingDir, testInfo.ModulePath));
            args.AddRange(GetInterpreterArgs(test, workingDir, settings.ProjectRootDir));

            //Debug.Fail("attach debugger");
            if (!File.Exists(settings.NodeExePath)) {
                frameworkHandle.SendMessage(TestMessageLevel.Error, "Interpreter path does not exist: " + settings.NodeExePath);
                return;
            }
            lock (_syncObject) {
                _nodeProcess = ProcessOutput.Run(
                                        settings.NodeExePath,
                                        args,
                                        workingDir,
                                        null,
                                        false,
                                        null,
                                        false);

#if DEBUG
                frameworkHandle.SendMessage(TestMessageLevel.Informational, "cd " + workingDir);
                frameworkHandle.SendMessage(TestMessageLevel.Informational, _nodeProcess.Arguments);
#endif

                _nodeProcess.Wait(TimeSpan.FromMilliseconds(500));
                if (runContext.IsBeingDebugged && app != null) {
                    try {
                        //the '#ping=0' is a special flag to tell VS node debugger not to connect to the port,
                        //because a connection carries the consequence of setting off --debug-brk, and breakpoints will be missed.
                        string qualifierUri = string.Format("tcp://localhost:{0}#ping=0", port);
                        while (!app.AttachToProcess(_nodeProcess, NodejsRemoteDebugPortSupplierUnsecuredId, qualifierUri)) {
                            if (_nodeProcess.Wait(TimeSpan.FromMilliseconds(500))) {
                                break;
                            }
                        }
#if DEBUG
                    } catch (COMException ex) {
                        frameworkHandle.SendMessage(TestMessageLevel.Error, "Error occurred connecting to debuggee.");
                        frameworkHandle.SendMessage(TestMessageLevel.Error, ex.ToString());
                        KillNodeProcess();
                    }
#else
                    } catch (COMException) {
                        frameworkHandle.SendMessage(TestMessageLevel.Error, "Error occurred connecting to debuggee.");
                        KillNodeProcess();
                    }
#endif
                }
            }
开发者ID:mauricionr,项目名称:nodejstools,代码行数:78,代码来源:TestExecutor.cs


示例20: TestExecutor

 public TestExecutor() {
     _app = VisualStudioApp.FromEnvironmentVariable(PythonConstants.PythonToolsProcessIdEnvironmentVariable);
     _interpreterService = InterpreterOptionsServiceProvider.GetService(_app);
 }
开发者ID:omnimark,项目名称:PTVS,代码行数:4,代码来源:TestExecutor.cs



注:本文中的Microsoft.VisualStudioTools.VisualStudioApp类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Project.ProjectElement类代码示例发布时间:2022-05-26
下一篇:
C# UnitTesting.TestContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap