Esempio n. 1
0
 protected virtual string PathTo(TreeNode givenNode)
 {
     StringBuilder nodePath = new StringBuilder();
     List<TreeNode> selectedNodePath = tree.GetPathTo(givenNode);
     foreach (TreeNode currentNode in selectedNodePath)
     {
         nodePath.AppendFormat("\"{0}\"", currentNode.Name);
         if (!selectedNodePath[selectedNodePath.Count - 1].Equals(currentNode)) nodePath.Append(",");
     }
     return nodePath.ToString();
 }
Esempio n. 2
0
                private static TestGroup ParseTestGroup(TreeNode testGroupNode)
                {
                    TestGroup testGroup = new TestGroup(testGroupNode.Text);

                    testGroupNode.Expand();
                    for (int i = 0; i < testGroupNode.Nodes.Count; i++)
                    {
                        if (i < testGroupNode.Nodes.Count - 1)
                        {
                            EnsureTestCaseNodeIsOnScreen(testGroupNode.Nodes[i + 1]);
                        }
                        testGroup.Add(ParseTestCase(testGroupNode.Nodes[i]));
                    }

                    return testGroup;
                }
Esempio n. 3
0
                private static TestCase ParseTestCase(TreeNode testNode)
                {
                    TestCase testResult = new TestCase();
                    testNode.Get<Label>("TestListViewDisplayNameTextBlock").Click();
                    testNode.Nodes.Count.Should().Be(0, "Test case tree node expected to have no children.");

                    SearchCriteria isControlTypeLabel = SearchCriteria.ByControlType(typeof(Label), WindowsFramework.Wpf);
                    // ReSharper disable once PossibleInvalidCastExceptionInForeachLoop
                    foreach (Label label in GetTestExplorerDetailsPanel().GetMultiple(isControlTypeLabel))
                    {
                        if (label.IsOffScreen || string.IsNullOrWhiteSpace(label.Text))
                            continue;

                        AddInfoFromDetailPane(testResult, label);
                    }

                    return testResult;
                }
Esempio n. 4
0
 public TreeNodeSelectEvent(Tree tree, TreeNode node)
     : base(tree)
 {
     selectedNode = node;
 }
Esempio n. 5
0
        private void CheckEntityProperties(TreeNode node, string entityType, string entityProperty, string propertyValue)
        {
            Dte.ExecuteCommand("View.EntityDataModelBrowser");
            ((ExpandCollapsePattern)node.AutomationElement.GetCurrentPattern(ExpandCollapsePattern.Pattern)).Expand();
            foreach (var childNode in node.Nodes)
            {
                var currentNode = _entityNames.Find(el => el.Equals(childNode.Text));
                if (string.IsNullOrEmpty(currentNode))
                {
                    continue;
                }
                Assert.AreEqual(string.Format(entityType, currentNode), childNode.Text);
                Dte.ExecuteCommand("View.EntityDataModelBrowser");
                ((ExpandCollapsePattern)childNode.AutomationElement.GetCurrentPattern(ExpandCollapsePattern.Pattern)).Expand();
                foreach (var propertyNode in childNode.Nodes)
                {
                    Dte.ExecuteCommand("View.EntityDataModelBrowser");
                    ((SelectionItemPattern)propertyNode.AutomationElement.GetCurrentPattern(SelectionItemPattern.Pattern)).Select();
                    var cleanProperty = propertyNode.Text.Replace(entityProperty, "");

                    CheckProperties(string.Format(propertyValue, ModelName, currentNode, cleanProperty));
                    Assert.IsTrue(_entityAttributes.Contains(cleanProperty));
                }
            }
        }
Esempio n. 6
0
 public TreeNodeClickedEvent(Tree tree, TreeNode node, bool isExpanded) : base(tree)
 {
     clickedNode = node;
     this.isExpanded = isExpanded;
 }
Esempio n. 7
0
 public virtual void Accept(TreeNode treeNode)
 {
     if (treeNode.Bounds.Top <= Mouse.Instance.Location.Y && treeNode.Bounds.Bottom >= Mouse.Instance.Location.Y)
         clickedNode = treeNode;
 }
Esempio n. 8
0
 /// <summary>
 /// Finds path to the TreeNode. It doesn't expand the nodes to find it.
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 public virtual List<TreeNode> GetPathTo(TreeNode node)
 {
     return Nodes.GetPathTo(node);
 }
Esempio n. 9
0
 private static bool SafeIsNodeOnScreen(TreeNode node)
 {
     try
     {
         return node.Visible;
     }
     catch (ElementNotAvailableException)
     {
         return false;
     }
 }
Esempio n. 10
0
            // ReSharper disable once UnusedMethodReturnValue.Local
            private static bool EnsureTestCaseNodeIsOnScreen(TreeNode node)
            {
                if (SafeIsNodeOnScreen(node))
                {
                    return true;
                }

                Tree tree = GetTestCaseTree();
                IVScrollBar scrollBar = tree.ScrollBars.Vertical;
                double initialValue = scrollBar.Value;
                while (scrollBar.Value < scrollBar.MaximumValue && !SafeIsNodeOnScreen(node))
                {
                    scrollBar.ScrollDownLarge();
                }

                if (!SafeIsNodeOnScreen(node))
                {
                    scrollBar.SetToMinimum();
                    while (scrollBar.Value < initialValue && !SafeIsNodeOnScreen(node))
                    {
                        scrollBar.ScrollDownLarge();
                    }
                }

                return SafeIsNodeOnScreen(node);
            }
Esempio n. 11
0
 private static bool EnsureTestGroupNodeIsOnScreen(TreeNode testGroupNode)
 {
     if (!SafeIsNodeOnScreen(testGroupNode) && testGroupNode.Nodes.Count > 0)
     {
         EnsureTestCaseNodeIsOnScreen(testGroupNode.Nodes[0]);
     }
     return SafeIsNodeOnScreen(testGroupNode);
 }
Esempio n. 12
0
 private static void ClickNode(TreeNode node)
 {
     EnsureTestCaseNodeIsOnScreen(node);
     node.Get<Label>("TestListViewDisplayNameTextBlock").Click();
 }
Esempio n. 13
0
 private static IDictionary<string, TreeNode> FindTestCaseNodes(TreeNode testGroupNode, List<string> displayNames)
 {
     IDictionary<string, TreeNode> result = new Dictionary<string, TreeNode>();
     testGroupNode.Expand();
     for (int i = 0; result.Count < displayNames.Count && i < testGroupNode.Nodes.Count; i++)
     {
         TreeNode node = testGroupNode.Nodes[i];
         EnsureTestCaseNodeIsOnScreen(node);
         foreach (string displayName in displayNames)
         {
             if (node.Text.StartsWith(displayName))
             {
                 result.Add(displayName, node);
             }
         }
     }
     return result;
 }