public void ClassOccursBeforeNamespaceOnInitialLoad() { MockCSharpProject project = new MockCSharpProject(); project.Name = "TestProject"; ReferenceProjectItem nunitFrameworkReferenceItem = new ReferenceProjectItem(project); nunitFrameworkReferenceItem.Include = "NUnit.Framework"; ProjectService.AddProjectItem(project, nunitFrameworkReferenceItem); List <IProject> projects = new List <IProject>(); projects.Add(project); // Add a test class with a TestFixture attributes. TestClass testClass = CreateTestClass("MyTests.MyTestFixture"); projectContent.Classes.Add(testClass.Class); // Add a second class with no namespace. testClass = CreateTestClass("AppleTestFixture"); projectContent.Classes.Add(testClass.Class); // Add another class that exists in a namespace inside // MyTests. testClass = CreateTestClass("MyTests.ZebraTests.AddZebra"); projectContent.Classes.Add(testClass.Class); // Load the project into the tree. treeView.Clear(); treeView.AddProject(project); projectNode = (TestProjectTreeNode)treeView.Nodes[0]; projectNode.PerformInitialization(); ExtTreeNode treeNode = (ExtTreeNode)projectNode.LastNode; treeNode.PerformInitialization(); // Get the class node without a root namespace and // the my tests namespace node. TestClassTreeNode appleTestFixtureNode = projectNode.FirstNode as TestClassTreeNode; TestNamespaceTreeNode myTestsNamespaceNode = projectNode.LastNode as TestNamespaceTreeNode; // Get the zebra namespace tree node. TestNamespaceTreeNode zebraTestsNamespaceNode = treeNode.LastNode as TestNamespaceTreeNode; Assert.IsNotNull(appleTestFixtureNode); Assert.AreEqual(appleTestFixtureNode.Text, "AppleTestFixture"); Assert.IsNotNull(myTestsNamespaceNode); Assert.AreEqual(myTestsNamespaceNode.Text, "MyTests"); Assert.IsNotNull(zebraTestsNamespaceNode); Assert.AreEqual(zebraTestsNamespaceNode.Text, "ZebraTests"); }
public void Init() { testFrameworks = new MockTestFrameworksWithNUnitFrameworkSupport(); treeView = new DummyParserServiceTestTreeView(testFrameworks); treeView.ProjectContentForProject = new MockProjectContent(); project = new MockCSharpProject(); project.Name = "MyProject"; ReferenceProjectItem refProjectItem = new ReferenceProjectItem(project); refProjectItem.Include = "NUnit.Framework"; ProjectService.AddProjectItem(project, refProjectItem); treeView.AddProject(project); }