public void CodeElements_ProjectHasEmptyNamespaceName_EmptyNamespaceNameNotIncludedInMembers() { CreateCodeModel(); helper.AddNamespaceCompletionEntriesInNamespace(String.Empty, String.Empty, "Tests"); CodeElements members = codeModel.CodeElements; CodeNamespace codeNamespace = members.FirstCodeNamespaceOrDefault(); Assert.AreEqual(1, members.Count); Assert.AreEqual("Tests", codeNamespace.Name); }
public void CodeElements_OneNamespaceInProject_ReturnsOneCodeNamespaceItem() { CreateCodeModel(); helper.AddNamespaceCompletionEntryInNamespace(String.Empty, "Test"); CodeElements codeElements = codeModel.CodeElements; CodeNamespace codeNamespace = codeElements.FirstCodeNamespaceOrDefault(); Assert.AreEqual(1, codeElements.Count); Assert.AreEqual("Test", codeNamespace.FullName); Assert.AreEqual("Test", codeNamespace.Name); }
public void CodeElements_OneNamespaceInProjectWithTwoPartsToName_ReturnsOneCodeNamespaceItemWithFirstPartOfNamespaceAsName() { CreateCodeModel(); helper.AddNamespaceCompletionEntryInNamespace(String.Empty, "First"); helper.AddNamespaceCompletionEntryInNamespace("First", "Second"); CodeElements codeElements = codeModel.CodeElements; CodeNamespace codeNamespace = codeElements.FirstCodeNamespaceOrDefault(); Assert.AreEqual(1, codeElements.Count); Assert.AreEqual("First", codeNamespace.FullName); Assert.AreEqual("First", codeNamespace.Name); }
public void Members_NamespaceHasOneChildNamespace_ReturnsOneChildNamespace() { CreateProjectContent(); helper.AddNamespaceCompletionEntryInNamespace("First", "Second"); CreateCodeNamespace("First"); CodeElements members = codeNamespace.Members; CodeNamespace childNamespace = members.FirstCodeNamespaceOrDefault(); Assert.AreEqual("First", codeNamespace.Name); Assert.AreEqual(1, members.Count); Assert.AreEqual("Second", childNamespace.Name); Assert.AreEqual("First.Second", childNamespace.FullName); }
public void Members_NamespaceHasOneChildNamespaceWithThreeNamespaceParts_ReturnsOneChildNamespaceWhichHasOneChildNamespace() { CreateProjectContent(); helper.AddNamespaceCompletionEntryInNamespace("First", "Second"); helper.AddNamespaceCompletionEntryInNamespace("First.Second", "Third"); helper.NoCompletionItemsInNamespace("First.Second.Third"); CreateCodeNamespace("First"); CodeElements members = codeNamespace.Members; CodeNamespace secondNamespace = members.FirstCodeNamespaceOrDefault(); CodeNamespace thirdNamespace = secondNamespace.Members.FirstCodeNamespaceOrDefault(); Assert.AreEqual("First", codeNamespace.Name); Assert.AreEqual(1, members.Count); Assert.AreEqual("Second", secondNamespace.Name); Assert.AreEqual("First.Second", secondNamespace.FullName); Assert.AreEqual(1, secondNamespace.Members.Count); Assert.AreEqual("First.Second.Third", thirdNamespace.FullName); Assert.AreEqual(0, thirdNamespace.Members.Count); }
public void CodeElements_TwoNamespacesInProjectWithFirstPartsTheName_ReturnsOneParentNamespaceWithTwoChildNamespaces() { CreateCodeModel(); helper.AddNamespaceCompletionEntryInNamespace(String.Empty, "First"); helper.AddNamespaceCompletionEntriesInNamespace("First", "A", "B"); helper.NoCompletionItemsInNamespace("First.A"); helper.NoCompletionItemsInNamespace("First.B"); CodeElements codeElements = codeModel.CodeElements; CodeNamespace codeNamespace = codeElements.FirstCodeNamespaceOrDefault(); CodeElements members = codeNamespace.Members; CodeNamespace firstChildNamespace = members.FirstCodeNamespaceOrDefault(); CodeNamespace secondChildNamespace = members.LastCodeNamespaceOrDefault(); Assert.AreEqual(1, codeElements.Count); Assert.AreEqual("First", codeNamespace.FullName); Assert.AreEqual(2, codeNamespace.Members.Count); Assert.AreEqual("A", firstChildNamespace.Name); Assert.AreEqual("B", secondChildNamespace.Name); }