Exemple #1
0
        /// <summary>
        /// Adds the project to the test tree view if the project
        /// has a reference to a supported test framework.
        /// </summary>
        /// <remarks>
        /// If the project is already in the tree then it will
        /// not be added again. If a project is already in the tree then
        /// an All Tests root node will be added.
        /// </remarks>
        public void AddProject(IProject project)
        {
            if (TestProject.IsTestProject(project))
            {
                if (GetProjectTreeNode(project) == null)
                {
                    // Add a new tree node.
                    IProjectContent projectContent = GetProjectContent(project);
                    if (projectContent != null)
                    {
                        TestProject         testProject = new TestProject(project, projectContent);
                        TestProjectTreeNode node        = new TestProjectTreeNode(testProject);

                        if (Nodes.Count == 0)
                        {
                            node.AddTo(this);
                        }
                        else
                        {
                            AllTestsTreeNode allTestsNode = GetAllTestsNode();
                            allTestsNode.AddProjectNode(node);
                        }

                        // Sort the nodes.
                        SortNodes(Nodes, true);
                    }
                }
            }
        }
Exemple #2
0
 void AddProjectTreeNodeToTree(TestProjectTreeNode node)
 {
     if (Nodes.Count == 0)
     {
         node.AddTo(this);
     }
     else
     {
         AllTestsTreeNode allTestsNode = GetAllTestsNode();
         allTestsNode.AddProjectNode(node);
     }
 }
Exemple #3
0
        /// <summary>
        /// Adds a new All Tests root node.
        /// </summary>
        void AddAllTestsNode()
        {
            // Save existing nodes (should only be one) before
            // clearing so we can add these to the new All Tests node.
            TreeNode[] projectNodes = new TreeNode[Nodes.Count];
            Nodes.CopyTo(projectNodes, 0);
            Nodes.Clear();

            allTestsNode           = new AllTestsTreeNode();
            allTestsNode.Disposed += AllTestsNodeDisposed;
            Nodes.Add(allTestsNode);

            // Add the original project nodes to the new
            // All Tests node.
            foreach (TestProjectTreeNode node in projectNodes)
            {
                allTestsNode.AddProjectNode(node);
            }
        }
		/// <summary>
		/// Adds a new All Tests root node.
		/// </summary>
		void AddAllTestsNode()
		{
			// Save existing nodes (should only be one) before 
			// clearing so we can add these to the new All Tests node.
			TreeNode[] projectNodes = new TreeNode[Nodes.Count];
			Nodes.CopyTo(projectNodes, 0);
			Nodes.Clear();
			
			allTestsNode = new AllTestsTreeNode();
			allTestsNode.Disposed += AllTestsNodeDisposed;
			Nodes.Add(allTestsNode);
			
			// Add the original project nodes to the new
			// All Tests node.
			foreach (TestProjectTreeNode node in projectNodes) {
				allTestsNode.AddProjectNode(node);
			}
		}