当前位置: 首页>>代码示例>>C#>>正文


C# VisualStudioApp.OpenProject方法代码示例

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


在下文中一共展示了VisualStudioApp.OpenProject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NavigateTo

        public void NavigateTo()
        {
            using (var app = new VisualStudioApp()) {
                app.OpenProject(@"TestData\Navigation.sln");

                using (var dialog = app.OpenNavigateTo()) {
                    dialog.SearchTerm = "Class";
                    Assert.AreEqual(4, dialog.WaitForNumberOfResults(4));
                }

                using (var dialog = app.OpenNavigateTo()) {
                    dialog.SearchTerm = "cls";
                    Assert.AreEqual(4, dialog.WaitForNumberOfResults(4));
                }

                using (var dialog = app.OpenNavigateTo()) {
                    dialog.SearchTerm = "func";
                    Assert.AreEqual(8, dialog.WaitForNumberOfResults(8));
                }

                using (var dialog = app.OpenNavigateTo()) {
                    dialog.SearchTerm = "fn";
                    Assert.AreEqual(8, dialog.WaitForNumberOfResults(8));
                }
            }
        }
开发者ID:,项目名称:,代码行数:26,代码来源:

示例2: ObjectBrowserBasicTest

        public void ObjectBrowserBasicTest() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\Outlining.sln");
                System.Threading.Thread.Sleep(1000);

                app.OpenObjectBrowser();
                var objectBrowser = app.ObjectBrowser;
                System.Threading.Thread.Sleep(1000);

                int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(4, nodeCount, "Node count: " + nodeCount.ToString());

                AssertNodes(objectBrowser,
                    new NodeInfo("Outlining", "Outlining"),
                    new NodeInfo("BadForStatement.py", "BadForStatement.py"),
                    new NodeInfo("NestedFuncDef.py", "NestedFuncDef.py", new[] { "f()" }),
                    new NodeInfo("Program.py", "Program.py", new[] { "f()" }));

                app.Dte.Solution.Close(false);

                System.Threading.Thread.Sleep(1000);
                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());
            }
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:31,代码来源:ObjectBrowserTest.cs

示例3: VisualStudioInstance

        public VisualStudioInstance(SolutionFile solution) {
            _solution = solution;
            _app = new VisualStudioApp();
            Project = _app.OpenProject(solution.Filename);

            ThreadHelper.Generic.Invoke(Keyboard.Reset);
            _solutionExplorer = _app.OpenSolutionExplorer();
            SelectSolutionNode();
        }
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:9,代码来源:VisualStudioInstance.cs

示例4: MoveFolderWithItem

        // Currently Fails: https://pytools.codeplex.com/workitem/2609
        public void MoveFolderWithItem() {
            using (var app = new VisualStudioApp()) {

                // close any projects before switching source control...
                app.Dte.Solution.Close();

                app.SelectSourceControlProvider("Test Source Provider");

                ExpectSourceControl();

                foreach (var projectType in ProjectTypes) {
                    var testDef = new ProjectDefinition("SourceControl", projectType,
                        PropertyGroup(
                            Property("SccProjectName", "HelloWorld"),
                            Property("SccLocalPath", "LocalPath"),
                            Property("SccAuxPath", "AuxPath"),
                            Property("SccProvider", "TestProvider")
                        ),
                        ItemGroup(
                            Folder("Fob"),
                            Folder("Fob\\Oar"),
                            Compile("Program"),
                            Compile("Fob\\Oar\\Quox")
                        )
                    );

                    using (var solution = testDef.Generate()) {
                        TestSccProvider.DocumentEvents.Clear();

                        var project = app.OpenProject(solution.Filename);
                        var window = app.OpenSolutionExplorer();
                        
                        var folder = window.WaitForItem("Solution 'SourceControl' (1 project)", "SourceControl", "Fob", "Oar");
                        var point = folder.GetClickablePoint();
                        Mouse.MoveTo(point);
                        Mouse.Down(MouseButton.Left);

                        var destFolder = window.WaitForItem("Solution 'SourceControl' (1 project)", "SourceControl");
                        Mouse.MoveTo(destFolder.GetClickablePoint());
                        Mouse.Up(MouseButton.Left);

                        window.AssertFileExists(Path.GetDirectoryName(solution.Filename), "Solution 'SourceControl' (1 project)", "SourceControl", "Oar", "Quox" + projectType.CodeExtension);
                        var projectDir = Path.GetDirectoryName(project.FullName);
                        AssertDocumentEvents(projectDir,
                            OnQueryRenameFiles(projectType.Code("Fob\\Oar\\Quox"), projectType.Code("Oar\\Quox"), VSQUERYRENAMEFILEFLAGS_NoFlags),
                            OnQueryRenameFiles("Fob\\Oar\\", "Oar", VSQUERYRENAMEFILEFLAGS_Directory),
                            OnAfterRenameFiles(projectType.Code("Fob\\Oar\\Quox"), projectType.Code("Oar\\Quox"), VSRENAMEFILEFLAGS_NoFlags),
                            OnAfterRenameFiles("Fob\\Oar\\", "Oar", VSRENAMEFILEFLAGS_Directory)
                        );
                    }
                }
            }
        }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:54,代码来源:SourceControl.cs

示例5: AddDifferentFileType

        public void AddDifferentFileType() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\HelloWorld.sln");
                string fullPath = TestData.GetPath(@"TestData\HelloWorld.sln");

                // "Python Environments", "References", "Search Paths", "Program.py"
                Assert.AreEqual(4, project.ProjectItems.Count);

                var item = project.ProjectItems.AddFromFileCopy(TestData.GetPath(@"TestData\Xaml\EmptyXName.xaml"));
                Assert.AreEqual("EmptyXName.xaml", item.Properties.Item("FileName").Value);
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:12,代码来源:NugetTests.cs

示例6: LoadNodejsProject

        public void LoadNodejsProject() {
            using (var app = new VisualStudioApp()) {
                app.OpenProject(@"TestData\HelloWorld.sln");

                Assert.IsTrue(app.Dte.Solution.IsOpen, "The solution is not open");
                Assert.IsTrue(app.Dte.Solution.Projects.Count == 1, String.Format("Loading project resulted in wrong number of loaded projects, expected 1, received {0}", app.Dte.Solution.Projects.Count));

                var iter = app.Dte.Solution.Projects.GetEnumerator();
                iter.MoveNext();
                Project project = (Project)iter.Current;
                Assert.AreEqual("HelloWorld.njsproj", Path.GetFileName(project.FileName), "Wrong project file name");
            }
        }
开发者ID:sramos30,项目名称:ntvsiot,代码行数:13,代码来源:BasicProjectTests.cs

示例7: DebugPythonProjectSubFolderStartupFileSysPath

        public void DebugPythonProjectSubFolderStartupFileSysPath() {
            using (var app = new VisualStudioApp()) {
                app.OpenProject(TestData.GetPath(@"TestData\SysPath.sln"));

                ClearOutputWindowDebugPaneText();
                app.Dte.ExecuteCommand("Debug.Start");
                WaitForMode(app, dbgDebugMode.dbgDesignMode);

                // sys.path should point to the startup file directory, not the project directory.
                // this matches the behavior of start without debugging.
                // Note: backslashes are escaped in the output
                string testDataPath = TestData.GetPath("TestData\\SysPath\\Sub'").Replace("\\", "\\\\");
                WaitForDebugOutput(text => text.Contains(testDataPath));
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:15,代码来源:DebugProject.cs

示例8: LoadRelativeProjects

        public void LoadRelativeProjects() {
            using (var app = new VisualStudioApp()) {
            string fullPath = TestData.GetPath(@"TestData\ProjectHomeProjects.sln");
                app.OpenProject(@"TestData\ProjectHomeProjects.sln", expectedProjects: 9);

                foreach (var project in app.Dte.Solution.Projects.OfType<Project>()) {
                    var name = Path.GetFileName(project.FileName);
                    if (name.StartsWith("ProjectA")) {
                        // Should have ProgramA.py, Subfolder\ProgramB.py and Subfolder\Subsubfolder\ProgramC.py
                        var programA = project.ProjectItems.Item("ProgramA.py");
                        Assert.IsNotNull(programA);

                        var subfolder = project.ProjectItems.Item("Subfolder");
                        var programB = subfolder.ProjectItems.Item("ProgramB.py");
                        Assert.IsNotNull(programB);

                        var subsubfolder = subfolder.ProjectItems.Item("Subsubfolder");
                        var programC = subsubfolder.ProjectItems.Item("ProgramC.py");
                        Assert.IsNotNull(programC);
                    } else if (name.StartsWith("ProjectB")) {
                        // Should have ProgramB.py and Subsubfolder\ProgramC.py
                        var programB = project.ProjectItems.Item("ProgramB.py");
                        Assert.IsNotNull(programB);

                        var subsubfolder = project.ProjectItems.Item("Subsubfolder");
                        var programC = subsubfolder.ProjectItems.Item("ProgramC.py");
                        Assert.IsNotNull(programC);
                    } else if (name.StartsWith("ProjectSln")) {
                        // Should have ProjectHomeProjects\ProgramA.py, 
                        // ProjectHomeProjects\Subfolder\ProgramB.py and
                        // ProjectHomeProjects\Subfolder\Subsubfolder\ProgramC.py
                        var projectHome = project.ProjectItems.Item("ProjectHomeProjects");
                        var programA = projectHome.ProjectItems.Item("ProgramA.py");
                        Assert.IsNotNull(programA);

                        var subfolder = projectHome.ProjectItems.Item("Subfolder");
                        var programB = subfolder.ProjectItems.Item("ProgramB.py");
                        Assert.IsNotNull(programB);

                        var subsubfolder = subfolder.ProjectItems.Item("Subsubfolder");
                        var programC = subsubfolder.ProjectItems.Item("ProgramC.py");
                        Assert.IsNotNull(programC);
                    } else {
                        Assert.Fail("Wrong project file name", name);
                    }
                }
            }
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:48,代码来源:ProjectHomeTests.cs

示例9: FileNamesResolve

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

                var ps = System.Management.Automation.PowerShell.Create();
                ps.AddScript(@"
                        param($project)
                        $folderProjectItem = $project.ProjectItems.Item(""Program.py"")
                        $result =  $folderProjectItem.FileNames(1)
                ");
                ps.AddParameter("project", project);
                ps.Invoke();
                var result = ps.Runspace.SessionStateProxy.GetVariable("result");

                var folder = project.ProjectItems.Item("Program.py");
                string path = folder.get_FileNames(1);
                
                Assert.AreEqual(path, result);
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:20,代码来源:NugetTests.cs

示例10: ProjectBuild

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

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

                string[] expectedOutputFiles = { "AppxManifest.xml", "HelloWorld.build.appxrecipe", "resources.pri", "startupinfo.xml" };

                string currentDir = Directory.GetCurrentDirectory();

                foreach (string s in expectedOutputFiles)
                {
                    Assert.AreEqual(true, File.Exists(string.Format("{0}\\TestData\\HelloWorld\\bin\\{1}", currentDir, s)),
                        string.Format("{0} is missing from bin output folder", s));
                }

                // TODO: 
                // Add test for rebuild
                // Add test to build all configs and platforms
            }
        }
开发者ID:sramos30,项目名称:ntvsiot,代码行数:22,代码来源:BasicProjectTests.cs

示例11: ObjectBrowserTypeBrowserSortTest

        public void ObjectBrowserTypeBrowserSortTest() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\MultiModule.sln");
                System.Threading.Thread.Sleep(1000);

                app.OpenObjectBrowser();
                var objectBrowser = app.ObjectBrowser;
                System.Threading.Thread.Sleep(1000);

                int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(3, nodeCount, "Node count: " + nodeCount.ToString());

                string str = objectBrowser.TypeBrowserPane.Nodes[1].Value;
                Assert.AreEqual("MyModule.py", str, "");
                str = objectBrowser.TypeBrowserPane.Nodes[2].Value;
                Assert.AreEqual("Program.py", str, "");

                objectBrowser.TypeBrowserPane.Nodes[1].ShowContextMenu();
                System.Threading.Thread.Sleep(1000);
                Condition con = new PropertyCondition(
                                        AutomationElement.ClassNameProperty,
                                        "ContextMenu"
                                    );
                AutomationElement el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);
                Assert.IsNotNull(el);
                Menu menu = new Menu(el);
                int itemCount = menu.Items.Count;
                Assert.AreEqual(7, itemCount, "Item count: " + itemCount.ToString());
                menu.Items[6].Check();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(4, nodeCount, "Node count: " + nodeCount.ToString());
                objectBrowser.TypeBrowserPane.Nodes[2].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(5, nodeCount, "Node count: " + nodeCount.ToString());
                Assert.AreEqual("Namespaces", objectBrowser.TypeBrowserPane.Nodes[3].Value, "");
                Assert.AreEqual("Namespaces", objectBrowser.TypeBrowserPane.Nodes[1].Value, "");
                objectBrowser.TypeBrowserPane.Nodes[3].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(6, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[3].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                objectBrowser.TypeBrowserPane.Nodes[0].ShowContextMenu();
                System.Threading.Thread.Sleep(1000);
                el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);
                Assert.IsNotNull(el);
                menu = new Menu(el);
                itemCount = menu.Items.Count;
                Assert.AreEqual(7, itemCount, "Item count: " + itemCount.ToString());
                Assert.IsTrue(menu.Items[6].ToggleStatus);
                menu.Items[3].Check();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(4, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[3].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(6, nodeCount, "Node count: " + nodeCount.ToString());

                str = objectBrowser.TypeBrowserPane.Nodes[1].Value;
                Assert.AreEqual("MyModule.py", str, "");
                str = objectBrowser.TypeBrowserPane.Nodes[2].Value;
                Assert.AreEqual("SchoolMember", str, "");
                str = objectBrowser.TypeBrowserPane.Nodes[3].Value;
                Assert.AreEqual("Program.py", str, "");
                str = objectBrowser.TypeBrowserPane.Nodes[4].Value;
                Assert.AreEqual("Student", str, "");
                str = objectBrowser.TypeBrowserPane.Nodes[5].Value;
                Assert.AreEqual("Teacher", str, "");
            }
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:87,代码来源:ObjectBrowserTest.cs

示例12: ObjectBrowserContextMenuBasicTest

        public void ObjectBrowserContextMenuBasicTest() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\MultiModule.sln");
                System.Threading.Thread.Sleep(1000);

                app.OpenObjectBrowser();
                var objectBrowser = app.ObjectBrowser;
                System.Threading.Thread.Sleep(1000);

                int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(3, nodeCount, "Node count: " + nodeCount.ToString());

                string str = objectBrowser.TypeBrowserPane.Nodes[1].Value;
                Assert.AreEqual("MyModule.py", str, "");
                str = objectBrowser.TypeBrowserPane.Nodes[2].Value;
                Assert.AreEqual("Program.py", str, "");

                objectBrowser.TypeBrowserPane.Nodes[2].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);
                objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(6, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[1].ShowContextMenu();
                System.Threading.Thread.Sleep(1000);
                Condition con = new PropertyCondition(
                                        AutomationElement.ClassNameProperty,
                                        "ContextMenu"
                                    );
                AutomationElement el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);
                Assert.IsNotNull(el);
                Menu menu = new Menu(el);
                int itemCount = menu.Items.Count;
                Assert.AreEqual(7, itemCount, "Item count: " + itemCount.ToString());
                Assert.AreEqual("Copy", menu.Items[0].Value.Trim(), "");
                Assert.AreEqual("View Namespaces", menu.Items[1].Value.Trim(), "");
                Assert.AreEqual("View Containers", menu.Items[2].Value.Trim(), "");
                Assert.AreEqual("Sort Alphabetically", menu.Items[3].Value.Trim(), "");
                Assert.AreEqual("Sort By Object Type", menu.Items[4].Value.Trim(), "");
                Assert.AreEqual("Sort By Object Access", menu.Items[5].Value.Trim(), "");
                Assert.AreEqual("Group By Object Type", menu.Items[6].Value.Trim(), "");
                Keyboard.PressAndRelease(System.Windows.Input.Key.Escape);

                objectBrowser.TypeBrowserPane.Nodes[2].ShowContextMenu();
                System.Threading.Thread.Sleep(1000);
                el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);
                Assert.IsNotNull(el);
                menu = new Menu(el);
                itemCount = menu.Items.Count;
                Assert.AreEqual(13, itemCount, "Item count: " + itemCount.ToString());
                Assert.AreEqual("Go To Definition", menu.Items[0].Value.Trim(), "");
                Assert.AreEqual("Go To Declaration", menu.Items[1].Value.Trim(), "");
                Assert.AreEqual("Go To Reference", menu.Items[2].Value.Trim(), "");
                Assert.AreEqual("Browse Definition", menu.Items[3].Value.Trim(), "");
                Assert.AreEqual("Find All References", menu.Items[4].Value.Trim(), "");
                Assert.AreEqual("Filter To Type", menu.Items[5].Value.Trim(), "");
                Assert.AreEqual("Copy", menu.Items[6].Value.Trim(), "");
                Assert.AreEqual("View Namespaces", menu.Items[7].Value.Trim(), "");
                Assert.AreEqual("View Containers", menu.Items[8].Value.Trim(), "");
                Assert.AreEqual("Sort Alphabetically", menu.Items[9].Value.Trim(), "");
                Assert.AreEqual("Sort By Object Type", menu.Items[10].Value.Trim(), "");
                Assert.AreEqual("Sort By Object Access", menu.Items[11].Value.Trim(), "");
                Assert.AreEqual("Group By Object Type", menu.Items[12].Value.Trim(), "");
                Keyboard.PressAndRelease(System.Windows.Input.Key.Escape);
            }
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:74,代码来源:ObjectBrowserTest.cs

示例13: ObjectBrowserNavigationTest

        public void ObjectBrowserNavigationTest() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\MultiModule.sln");
                System.Threading.Thread.Sleep(1000);

                app.OpenObjectBrowser();
                var objectBrowser = app.ObjectBrowser;
                objectBrowser.EnsureLoaded();

                int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(3, nodeCount, "Node count: " + nodeCount.ToString());

                string str = objectBrowser.TypeBrowserPane.Nodes[1].Value;
                Assert.AreEqual("MyModule.py", str, "");
                str = objectBrowser.TypeBrowserPane.Nodes[2].Value;
                Assert.AreEqual("Program.py", str, "");

                objectBrowser.TypeBrowserPane.Nodes[2].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);
                objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(6, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[4].Select();
                System.Threading.Thread.Sleep(1000);
                objectBrowser.TypeBrowserPane.Nodes[4].DoubleClick();
                System.Threading.Thread.Sleep(1000);

                str = app.Dte.ActiveDocument.Name;
                Assert.AreEqual("Program.py", str, "");

                int lineNo = ((TextSelection)app.Dte.ActiveDocument.Selection).ActivePoint.Line;
                Assert.AreEqual(14, lineNo, "Line number: " + lineNo.ToString());

                app.OpenObjectBrowser();
                objectBrowser.TypeBrowserPane.Nodes[2].Select();
                System.Threading.Thread.Sleep(1000);
                objectBrowser.TypeBrowserPane.Nodes[2].DoubleClick();
                System.Threading.Thread.Sleep(1000);

                str = app.Dte.ActiveDocument.Name;
                Assert.AreEqual("MyModule.py", str, "");

                lineNo = ((TextSelection)app.Dte.ActiveDocument.Selection).ActivePoint.Line;
                Assert.AreEqual(1, lineNo, "Line number: " + lineNo.ToString());

                objectBrowser.TypeBrowserPane.Nodes[3].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);
                objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);
            }
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:60,代码来源:ObjectBrowserTest.cs

示例14: ObjectBrowserInheritanceRelationshipTest

        public void ObjectBrowserInheritanceRelationshipTest() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\Inheritance.sln");
                System.Threading.Thread.Sleep(1000);

                app.OpenObjectBrowser();
                var objectBrowser = app.ObjectBrowser;
                System.Threading.Thread.Sleep(1000);

                int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);
                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(2, nodeCount, "Node count: " + nodeCount.ToString());

                string str = objectBrowser.TypeBrowserPane.Nodes[1].Value;
                Assert.AreEqual("Program.py", str, "");

                objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(5, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[3].Select();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeNavigatorPane.Nodes.Count;
                Assert.AreEqual(2, nodeCount, "Node Count: " + nodeCount.ToString());
                str = objectBrowser.TypeNavigatorPane.Nodes[0].Value;
                Assert.IsTrue(str.Trim().StartsWith("__init__(self"), str);
                str = objectBrowser.TypeNavigatorPane.Nodes[1].Value;
                Assert.AreEqual("tell(self)", str.Trim(), "");

                str = objectBrowser.DetailPane.Value;
                Assert.IsTrue(str.Trim().Contains("Student(SchoolMember)"), str);
                Assert.IsTrue(str.Trim().Contains("Represents a student."), str);

                objectBrowser.TypeNavigatorPane.Nodes[1].Select();
                System.Threading.Thread.Sleep(1000);

                str = objectBrowser.DetailPane.Value;
                Assert.IsTrue(str.Trim().Contains("def tell(self)"), str);

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);
            }
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:50,代码来源:ObjectBrowserTest.cs

示例15: ObjectBrowserExpandTypeBrowserTest

        public void ObjectBrowserExpandTypeBrowserTest() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\Inheritance.sln");
                System.Threading.Thread.Sleep(1000);

                app.OpenObjectBrowser();
                var objectBrowser = app.ObjectBrowser;
                objectBrowser.EnsureLoaded();

                int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

                string str = objectBrowser.TypeBrowserPane.Nodes[0].Value;
                Assert.AreEqual("Inheritance", str, "");
                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);
                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(2, nodeCount, "Node count: " + nodeCount.ToString());

                str = objectBrowser.TypeBrowserPane.Nodes[1].Value;
                Assert.AreEqual("Program.py", str, "");

                objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(5, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());
            }
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:35,代码来源:ObjectBrowserTest.cs


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