Пример #1
0
        public void AddNewMethodNodeWhenTestPassed()
        {
            testMethod.Result = TestResultType.Success;
            TestMethodTreeNode node = new TestMethodTreeNode(testProject, testMethod);

            Assert.AreEqual(TestTreeViewImageListIndex.TestPassed, (TestTreeViewImageListIndex)node.ImageIndex);
        }
Пример #2
0
        public void MethodRemoved()
        {
            TestProjectTreeNode projectNode = (TestProjectTreeNode)rootNode;
            TestClass           testClass   = projectNode.TestProject.TestClasses["RootNamespace.Tests.MyTestFixture"];

            TestMethodTreeNode methodNode = (TestMethodTreeNode)testFixtureNode.Nodes[0];
            TestMethod         testMethod = testClass.TestMethods[0];

            testClass.TestMethods.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");
        }
Пример #3
0
        public void ClassRemoved()
        {
            TestProjectTreeNode projectNode = (TestProjectTreeNode)rootNode;
            TestClass           testClass   = projectNode.TestProject.TestClasses["RootNamespace.Tests.MyTestFixture"];
            TestMethodTreeNode  methodNode  = (TestMethodTreeNode)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.TestMethods.RemoveAt(0);

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