예제 #1
0
        /// <summary>
        /// A node has been matched with a test, so update it
        /// and then process child nodes and tests recursively.
        /// If a child was added or removed, then this node
        /// will expand itself.
        /// </summary>
        /// <param name="node">Node to be updated</param>
        /// <param name="test">Test to plug into node</param>
        /// <returns>True if a child node was added or deleted</returns>
        private bool UpdateNode(TestSuiteTreeNode node, TestNode test)
        {
            if (node.Test.TestName.FullName != test.TestName.FullName)
            {
                throw(new ArgumentException(
                          string.Format("Attempting to update {0} with {1}", node.Test.TestName.FullName, test.TestName.FullName)));
            }

            treeMap.Remove(node.Test.TestName.UniqueName);
            node.Test = test;
            treeMap.Add(test.TestName.UniqueName, node);

            if (!test.IsSuite)
            {
                return(false);
            }

            bool showChildren = UpdateNodes(node.Nodes, test.Tests);

            if (showChildren)
            {
                node.Expand();
            }

            return(showChildren);
        }
예제 #2
0
 public override void Visit(TestSuiteTreeNode node)
 {
     if (node.WasExpanded && !node.IsExpanded)
     {
         node.Expand();
     }
     node.Checked = node.WasChecked;
 }
예제 #3
0
        /// <summary>
        /// When Expand context menu item is clicked, expand the node
        /// </summary>
        private void expandMenuItem_Click(object sender, System.EventArgs e)
        {
            TestSuiteTreeNode targetNode = contextNode != null ? contextNode : (TestSuiteTreeNode)SelectedNode;

            if (targetNode != null)
            {
                targetNode.Expand();
            }
        }
예제 #4
0
 /// <summary>
 /// Helper expands all fixtures under a node
 /// </summary>
 /// <param name="node">Node under which to expand fixtures</param>
 private void ExpandFixturesUnderNode(TestSuiteTreeNode node)
 {
     if (node.Test.IsFixture)
     {
         node.Expand();
     }
     else
     {
         foreach (TestSuiteTreeNode child in node.Nodes)
         {
             ExpandFixturesUnderNode(child);
         }
     }
 }
예제 #5
0
        /// <summary>
        /// A node has been matched with a test, so update it
        /// and then process child nodes and tests recursively.
        /// If a child was added or removed, then this node
        /// will expand itself.
        /// </summary>
        /// <param name="node">Node to be updated</param>
        /// <param name="test">Test to plug into node</param>
        /// <returns>True if a child node was added or deleted</returns>
        private bool UpdateNode(TestSuiteTreeNode node, UITestNode test)
        {
            node.UpdateTest(test);

            if (!test.IsSuite)
            {
                return(false);
            }

            bool showChildren = UpdateNodes(node.Nodes, test.Tests);

            if (showChildren)
            {
                node.Expand();
            }

            return(showChildren);
        }
예제 #6
0
        /// <summary>
        /// Helper collapses all fixtures under a node
        /// </summary>
        /// <param name="node">Node under which to collapse fixtures</param>
        private void HideTestsUnderNode(TestSuiteTreeNode node)
        {
            if (node.Test.IsSuite)
            {
                if (node.Test.TestType == "TestFixture")
                {
                    node.Collapse();
                }
                else
                {
                    node.Expand();

                    foreach (TestSuiteTreeNode child in node.Nodes)
                    {
                        HideTestsUnderNode(child);
                    }
                }
            }
        }
예제 #7
0
        /// <summary>
        /// Helper collapses all fixtures under a node
        /// </summary>
        /// <param name="node">Node under which to collapse fixtures</param>
        private void HideTestsUnderNode(TestSuiteTreeNode node)
        {
            bool expand = false;

            foreach (TestSuiteTreeNode child in node.Nodes)
            {
                if (child.Test.IsSuite)
                {
                    expand = true;
                    HideTestsUnderNode(child);
                }
            }

            if (expand)
            {
                node.Expand();
            }
            else
            {
                node.Collapse();
            }
        }
예제 #8
0
        /// <summary>
        /// Helper collapses all fixtures under a node
        /// </summary>
        /// <param name="node">Node under which to collapse fixtures</param>
        private void HideTestsUnderNode( TestSuiteTreeNode node )
        {
            bool expand = false;
            foreach( TestSuiteTreeNode child in node.Nodes )
                if ( child.Test.IsSuite )
                {
                    expand = true;
                    HideTestsUnderNode( child );
                }

            if ( expand )
                node.Expand();
            else
                node.Collapse();
        }
예제 #9
0
        /// <summary>
        /// A node has been matched with a test, so update it
        /// and then process child nodes and tests recursively.
        /// If a child was added or removed, then this node
        /// will expand itself.
        /// </summary>
        /// <param name="node">Node to be updated</param>
        /// <param name="test">Test to plug into node</param>
        /// <returns>True if a child node was added or deleted</returns>
        private bool UpdateNode( TestSuiteTreeNode node, TestNode test, IList deletedNodes )
        {
            if ( node.Test.TestName.FullName != test.TestName.FullName )
                throw( new TreeStructureChangedException(
                    string.Format( "Attempting to update {0} with {1}", node.Test.TestName.FullName, test.TestName.FullName ) ) );

            treeMap.Remove( node.Test.TestName.UniqueName );
            node.Test = test;
            treeMap.Add( test.TestName.UniqueName, node );

            if ( !test.IsSuite )
                return false;

            bool showChildren = UpdateNodes( node.Nodes, test.Tests, deletedNodes );

            if ( showChildren ) node.Expand();

            return showChildren;
        }
예제 #10
0
 /// <summary>
 /// When Expand context menu item is clicked, expand the node
 /// </summary>
 private void expandMenuItem_Click(object sender, System.EventArgs e)
 {
     contextNode.Expand();
 }
		/// <summary>
		/// Helper collapses all fixtures under a node
		/// </summary>
		/// <param name="node">Node under which to collapse fixtures</param>
		private void HideTestsUnderNode( TestSuiteTreeNode node )
		{
            if (node.Test.IsSuite)
            {
                if (node.Test.TestType == "TestFixture")
                    node.Collapse();
                else
                {
                    node.Expand();

                    foreach (TestSuiteTreeNode child in node.Nodes)
                        HideTestsUnderNode(child);
                }
            }
		}
예제 #12
0
 public override void Visit(TestSuiteTreeNode node)
 {
     if ( node.WasExpanded && !node.IsExpanded )
         node.Expand();
     node.Checked = node.WasChecked;
 }