private static SmartTreeNode CreateOrFindClassNode(ITestAssembly ta, SmartTreeNodeCollection nodes,
                                                           string[] classFullNameParts, int index)
        {
            foreach (SmartTreeNode node in nodes)
            {
                if (node.Text == classFullNameParts[index])
                {
                    index++;
                    if (index < classFullNameParts.Length)
                    {
                        return(CreateOrFindClassNode(ta, node.Nodes, classFullNameParts, index));
                    }
                    else
                    {
                        return(node);
                    }
                }
            }
            SmartTreeNode newNode = new SmartTreeNode(classFullNameParts[index]);

            newNode.ImageIndex = 1;
            newNode.Tag        = new UiElementInfo(ta, new TestSuite(classFullNameParts, index));
            nodes.Add(newNode);
            while (++index < classFullNameParts.Length)
            {
                SmartTreeNode child = new SmartTreeNode(classFullNameParts[index]);
                child.ImageIndex = 1;
                child.Tag        = new UiElementInfo(ta, new TestSuite(classFullNameParts, index));
                newNode.Nodes.Add(child);
                newNode = child;
            }
            newNode.ImageIndex = 2;
            newNode.Tag        = null;
            return(newNode);
        }
 private void CollectNodesFrom(SmartTreeNodeCollection nodes)
 {
     foreach (SmartTreeNode node in nodes)
     {
         _nodes.Add(node);
         CollectNodesFrom(node.Nodes);
     }
 }
Esempio n. 3
0
      public SmartTree() {
         InitializeComponent();

         _contentPanel.SetOwnerTree(this);

         _rootNodes = new SmartTreeNodeCollection(null, this);
         _selectedNodes = new List<SmartTreeNode>();
         // TODO: need to sign up for change event on this collection, e.g.
         // when a node is added/removed. Then those nodes need to be 
         // invalidated. [17apr08, ml]
      }
        private static SmartTreeNode CreateOrFindMethodNode(SmartTreeNodeCollection nodes, ITestMethodInfo tm)
        {
            foreach (SmartTreeNode node in nodes)
            {
                if (node.Text == tm.Name)
                {
                    return(node);
                }
            }
            SmartTreeNode newNode = new SmartTreeNode(tm.Name);

            newNode.ImageIndex = 3;
            nodes.Add(newNode);
            return(newNode);
        }
 private void SetCheckedStatus(SmartTreeNodeCollection nodes)
 {
     foreach (SmartTreeNode node in nodes)
     {
         UiElementInfo elementInfo = node.Tag as UiElementInfo;
         if (elementInfo != null)
         {
             node.Checked = _checkedTestSelector.Contains(elementInfo);
         }
         if (node.Nodes.Count > 0)
         {
             SetCheckedStatus(node.Nodes);
         }
     }
 }
 private static SmartTreeNode FindTestFixtureNode(SmartTreeNodeCollection nodes, string fixtureName)
 {
     foreach (SmartTreeNode node in nodes)
     {
         if (node.Tag is UiElementInfo)
         {
             UiElementInfo info = (UiElementInfo)node.Tag;
             if (info.IsFixtureItem &&
                 info.FixtureName == fixtureName)
             {
                 return(node);
             }
             else
             {
                 SmartTreeNode child = FindTestFixtureNode(node.Nodes, fixtureName);
                 if (child != null)
                 {
                     return(child);
                 }
             }
         }
     }
     return(null);
 }
 private static SmartTreeNode FindTestMethodNode(SmartTreeNodeCollection nodes, string methodFullName)
 {
     foreach (SmartTreeNode node in nodes)
     {
         if (node.Tag is UiElementInfo)
         {
             UiElementInfo info = (UiElementInfo)node.Tag;
             if (info.IsMethodItem &&
                 info.MethodFullName == methodFullName)
             {
                 return(node);
             }
             else
             {
                 SmartTreeNode child = FindTestMethodNode(node.Nodes, methodFullName);
                 if (child != null)
                 {
                     return(child);
                 }
             }
         }
     }
     return(null);
 }
Esempio n. 8
0
 public SmartTreeNode() {
    _nodes = new SmartTreeNodeCollection(this, _ownerTree);
    
 }