Beispiel #1
0
        private static void AssertNodes(ObjectBrowser objectBrowser, params NodeInfo[] expectedNodes) {
            int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(expectedNodes.Length, nodeCount, "Node count: " + nodeCount.ToString());

            for (int i = 0; i < expectedNodes.Length; ++i) {
                // Check node name
                string str = objectBrowser.TypeBrowserPane.Nodes[i].Value.Trim();
                Assert.AreEqual(expectedNodes[i].Name, str, "");

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

                // Check detailed node description.
                str = objectBrowser.DetailPane.Value.Trim();
                Assert.AreEqual(expectedNodes[i].Description, str, "");

                // Check dependent nodes in member pane
                nodeCount = objectBrowser.TypeNavigatorPane.Nodes.Count;
                var expectedMembers = expectedNodes[i].Members;
                if (expectedMembers == null) {
                    Assert.AreEqual(0, nodeCount, "Node Count: " + nodeCount.ToString());
                } else {
                    Assert.AreEqual(expectedMembers.Count, nodeCount, "Node Count: " + nodeCount.ToString());
                    for (int j = 0; j < expectedMembers.Count; ++j) {
                        str = objectBrowser.TypeNavigatorPane.Nodes[j].Value.Trim();
                        Assert.AreEqual(expectedMembers[j], str, "");
                    }
                }
            }
        }
Beispiel #2
0
        private static void AssertNodes(ObjectBrowser objectBrowser, bool expand, params NodeInfo[] expectedNodes) {

            for (int i = 0; i < expectedNodes.Length; ++i) {
                // Check node name
                for (int j = 0; j < 100; j++) {
                    if (i < objectBrowser.TypeBrowserPane.Nodes.Count) {
                        break;
                    }
                    System.Threading.Thread.Sleep(250);
                }

                string str = objectBrowser.TypeBrowserPane.Nodes[i].Value.Trim();
                Console.WriteLine("Found node: {0}", str);
                Assert.AreEqual(expectedNodes[i].Name, str, "");

                objectBrowser.TypeBrowserPane.Nodes[i].Select();
                if (expand) {
                    try {
                        objectBrowser.TypeBrowserPane.Nodes[i].ExpandCollapse();
                    } catch (InvalidOperationException) {
                    }
                }

                System.Threading.Thread.Sleep(1000);

                // Check detailed node description.
                str = objectBrowser.DetailPane.Value.Trim();
                if(expectedNodes[i].Description != str) {
                    for (int j = 0; j < str.Length; j++) {
                        Console.WriteLine("{0} {1}", (int)str[j], (int)expectedNodes[i].Description[j]);
                    }
                }
                Assert.AreEqual(expectedNodes[i].Description, str, "");

                // Check dependent nodes in member pane
                int nodeCount = objectBrowser.TypeNavigatorPane.Nodes.Count;
                var expectedMembers = expectedNodes[i].Members;
                if (expectedMembers == null) {
                    Assert.AreEqual(0, nodeCount, "Node Count: " + nodeCount.ToString());
                } else {
                    Assert.AreEqual(expectedMembers.Count, nodeCount, "Node Count: " + nodeCount.ToString());
                    for (int j = 0; j < expectedMembers.Count; ++j) {
                        str = objectBrowser.TypeNavigatorPane.Nodes[j].Value.Trim();
                        Assert.AreEqual(expectedMembers[j], str, "");
                    }
                }
            }
        }
Beispiel #3
0
 private static void AssertNodes(ObjectBrowser objectBrowser, params NodeInfo[] expectedNodes)
 {
     AssertNodes(objectBrowser, true, expectedNodes);
 }