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


C# VisualStudioApp.OpenObjectBrowser方法代码示例

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


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

示例1: 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

示例2: ObjectBrowserFindAllReferencesTest

        public void ObjectBrowserFindAllReferencesTest() {
            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[4].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(13, itemCount, "Item count: " + itemCount.ToString());
                menu.Items[4].Check();
                System.Threading.Thread.Sleep(1000);

                //this needs to be updated for bug #4840
                str = app.Dte.ActiveWindow.Caption;
                Assert.IsTrue(str.Contains("2 matches found"), str);

                objectBrowser.TypeBrowserPane.Nodes[2].ShowContextMenu();
                System.Threading.Thread.Sleep(1000);
                el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);
                Assert.IsNotNull(el);
                menu = new Menu(el);
                menu.Items[4].Check();
                System.Threading.Thread.Sleep(1000);

                str = app.Dte.ActiveWindow.Caption;
                Assert.IsTrue(str.Contains("2 matches found"), str);
            }
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:61,代码来源:ObjectBrowserTest.cs

示例3: 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

示例4: ObjectBrowserNavigateVarContextMenuTest

        public void ObjectBrowserNavigateVarContextMenuTest() {
            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].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(13, itemCount, "Item count: " + itemCount.ToString());
                menu.Items[0].Check();
                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[5].ShowContextMenu();
                System.Threading.Thread.Sleep(1000);
                el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);
                Assert.IsNotNull(el);
                menu = new Menu(el);
                menu.Items[0].Check();
                System.Threading.Thread.Sleep(1000);

                lineNo = ((TextSelection)app.Dte.ActiveDocument.Selection).ActivePoint.Line;
                Assert.AreEqual(3, lineNo, "Line number: " + lineNo.ToString());
            }
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:64,代码来源:ObjectBrowserTest.cs

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: ObjectBrowserSearchTextTest

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

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

                // Initially, we should have only the top-level collapsed node for the project

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

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

                // Now that it is expanded, we should also get a node for Program.py

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

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

                // Sanity-check the starting view with all nodes expanded.

                var expectedNodesBeforeSearch = new[] {
                new NodeInfo("ObjectBrowser", "ObjectBrowser"),
                new NodeInfo("Program.py", "Program.py", new[] { "frob()" }),
                new NodeInfo("Oar", "class Oar", new[] { "oar(self)" }),
                new NodeInfo("Fob", "class Fob"),
                new NodeInfo("FobOarBaz", "class FobOarBaz", new[] { "frob(self)" }),
            };
                AssertNodes(objectBrowser, expectedNodesBeforeSearch);

                // Do the search and check results

                objectBrowser.SearchText.SetValue("oar");
                System.Threading.Thread.Sleep(1000);

                objectBrowser.SearchButton.Click();
                System.Threading.Thread.Sleep(1000);

                var expectedNodesAfterSearch = new[] {
                new NodeInfo("oar", "def oar(self)"),
                new NodeInfo("Oar", "class Oar", new[] { "oar(self)" }),
                new NodeInfo("FobOarBaz", "class FobOarBaz", new[] { "frob(self)" }),
            };
                AssertNodes(objectBrowser, expectedNodesAfterSearch);

                // Clear the search and check that we get back to the starting view.

                objectBrowser.ClearSearchButton.Click();
                System.Threading.Thread.Sleep(1000);

                AssertNodes(objectBrowser, expectedNodesBeforeSearch);
            }
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:59,代码来源:ObjectBrowserTest.cs


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