public void CodeElements_OneNamespaceInProject_ReturnsOneCodeNamespaceItem() { CreateCodeModel(); AddClassToProject("namespace Test {}"); global::EnvDTE.CodeElements codeElements = codeModel.CodeElements; global::EnvDTE.CodeNamespace codeNamespace = codeElements .FindFirstCodeNamespaceOrDefault(e => e.Name == "Test"); Assert.AreEqual("Test", codeNamespace.FullName); Assert.AreEqual("Test", codeNamespace.Name); }
public void CodeModel_EmptyNamespaceExistsInProject_CodeElementsReturnsNamespace() { CreateProject(); AddClassToProject("namespace Test {}"); global::EnvDTE.CodeElements codeElements = dteProject.CodeModel.CodeElements; global::EnvDTE.CodeNamespace codeNamespace = codeElements .FindFirstCodeNamespaceOrDefault(e => e.Name == "Test"); Assert.AreEqual("Test", codeNamespace.FullName); Assert.AreEqual("Test", codeNamespace.Name); }
public void CodeElements_OneNamespaceInProjectWithTwoPartsToName_ReturnsOneCodeNamespaceItemWithFirstPartOfNamespaceAsName() { CreateCodeModel(); AddClassToProject("namespace First.Second {}"); global::EnvDTE.CodeElements codeElements = codeModel.CodeElements; global::EnvDTE.CodeNamespace codeNamespace = codeElements .FindFirstCodeNamespaceOrDefault(e => e.Name == "First"); global::EnvDTE.CodeNamespace secondCodeNamespace = codeNamespace.Members.FirstCodeNamespaceOrDefault(); Assert.AreEqual("First", codeNamespace.FullName); Assert.AreEqual("First", codeNamespace.Name); Assert.AreEqual("Second", secondCodeNamespace.Name); Assert.AreEqual("First.Second", secondCodeNamespace.FullName); }