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
 /// <summary>
 /// If the project item removed is a reference to a unit
 /// test framework then the project will be removed from the
 /// test tree.
 /// </summary>
 protected void ProjectItemRemoved(ProjectItem projectItem)
 {
     if (IsTestFrameworkReferenceProjectItem(projectItem))
     {
         if (!TestProject.IsTestProject(projectItem.Project))
         {
             treeView.RemoveProject(projectItem.Project);
         }
     }
 }
Exemple #3
0
        /// <summary>
        /// Adds or removes a project from the test tree view based on
        /// whether a reference to a testing framework has been added or
        /// removed.
        /// </summary>
        public void ProjectReferencesChanged(IProject project)
        {
            TestProjectTreeNode projectNode = GetProjectTreeNode(project);

            if (TestProject.IsTestProject(project))
            {
                if (projectNode == null)
                {
                    TestProject testProject = new TestProject(project, GetProjectContent(project));
                    projectNode = new TestProjectTreeNode(testProject);
                    projectNode.AddTo(this);
                }
            }
            else
            {
                RemoveProjectNode(projectNode);
            }
        }