public void MethodRemoved()
        {
            TestProjectTreeNode projectNode = (TestProjectTreeNode)rootNode;
            TestClass           testClass   = projectNode.TestProject.TestClasses["RootNamespace.Tests.MyTestFixture"];

            TestMemberTreeNode methodNode = (TestMemberTreeNode)testFixtureNode.Nodes[0];
            TestMember         testMethod = testClass.TestMembers[0];

            testClass.TestMembers.Remove(testMethod);

            Assert.AreEqual(0, testFixtureNode.Nodes.Count);
            Assert.IsTrue(methodNode.IsDisposed);

            // Make sure the TestMethod.Dispose call removes all
            // event handlers by changing the TestMethod's test
            // result and seeing if the test method node is
            // affected even though we have removed it from the tree.

            // Make sure the test method result is not already a failure.
            testMethod.Result = TestResultType.None;
            testMethod.Result = TestResultType.Failure;
            Assert.AreEqual(TestTreeViewImageListIndex.TestNotRun,
                            (TestTreeViewImageListIndex)methodNode.ImageIndex,
                            "Disposed TestMethodTreeNode was affected by TestMethod result change");
        }
        public void AddNewMethodNodeWhenTestPassed()
        {
            testMethod.Result = TestResultType.Success;
            TestMemberTreeNode node = new TestMemberTreeNode(testProject, testMethod);

            Assert.AreEqual(TestTreeViewImageListIndex.TestPassed, (TestTreeViewImageListIndex)node.ImageIndex);
        }
        public void ClassRemoved()
        {
            TestProjectTreeNode projectNode = (TestProjectTreeNode)rootNode;
            TestClass           testClass   = projectNode.TestProject.TestClasses["RootNamespace.Tests.MyTestFixture"];
            TestMemberTreeNode  methodNode  = (TestMemberTreeNode)testFixtureNode.Nodes[0];

            testFixtureNode.Expanding();

            // Sanity check - test fixture node should have one method node.
            Assert.AreEqual(1, testFixtureNode.Nodes.Count);

            projectNode.TestProject.TestClasses.Remove(testClass);

            // Method node should be disposed when parent class
            // node is disposed.
            Assert.IsTrue(methodNode.IsDisposed);

            // Make sure the TestClass.Dispose call removes all
            // event handlers.
            testClass.TestMembers.RemoveAt(0);

            Assert.AreEqual(1, testFixtureNode.Nodes.Count,
                            "Should still have one child node.");
        }