public void Members_ProjectHasTwoNamespacesWithCommonFirstAndSecondPartOfThreePartNamespace_ReturnsOneChildNamespaceWhichHasOneChildNamespace()
        {
            CreateProjectContent();
            helper.AddNamespaceCompletionEntryInNamespace("First", "Second");
            helper.AddNamespaceCompletionEntriesInNamespace("First.Second", "Third", "Different");
            CreateCodeNamespace("First");

            global::EnvDTE.CodeElements members = codeNamespace.Members;
            CodeNamespace secondNamespace       = members.FirstOrDefault() as CodeNamespace;

            Assert.AreEqual("First", codeNamespace.Name);
            Assert.AreEqual(1, members.Count);
            Assert.AreEqual("Second", secondNamespace.Name);
            Assert.AreEqual("First.Second", secondNamespace.FullName);
            Assert.AreEqual(2, secondNamespace.Members.Count);
        }
        public void Members_ProjectHasTwoNamespacesWithCommonFirstAndSecondPartOfThreePartNamespace_ReturnsOneChildNamespaceWhichHasOneChildNamespace()
        {
            string code =
                "namespace First.Second {\r\n" +
                "    namespace Third {}\r\n" +
                "    namespace Different {}\r\n" +
                "}";

            CreateCodeNamespace(code, "First");

            global::EnvDTE.CodeElements members = codeNamespace.Members;
            CodeNamespace secondNamespace       = members.FirstOrDefault() as CodeNamespace;

            Assert.AreEqual("First", codeNamespace.Name);
            Assert.AreEqual(1, members.Count);
            Assert.AreEqual("Second", secondNamespace.Name);
            Assert.AreEqual("First.Second", secondNamespace.FullName);
            Assert.AreEqual(2, secondNamespace.Members.Count);
        }
예제 #3
0
 public static CodeImport FirstCodeImportOrDefault(this global::EnvDTE.CodeElements codeElements)
 {
     return(codeElements.FirstOrDefault() as CodeImport);
 }
예제 #4
0
 public static CodeParameter2 FirstCodeParameter2OrDefault(this global::EnvDTE.CodeElements codeElements)
 {
     return(codeElements.FirstOrDefault() as CodeParameter2);
 }
예제 #5
0
 public static CodeVariable FirstCodeVariableOrDefault(this global::EnvDTE.CodeElements codeElements)
 {
     return(codeElements.FirstOrDefault() as CodeVariable);
 }
예제 #6
0
 public static CodeProperty2 FirstCodeProperty2OrDefault(this global::EnvDTE.CodeElements codeElements)
 {
     return(codeElements.FirstOrDefault() as CodeProperty2);
 }
예제 #7
0
 public static CodeAttribute2 FirstCodeAttribute2OrDefault(this global::EnvDTE.CodeElements codeElements)
 {
     return(codeElements.FirstOrDefault() as CodeAttribute2);
 }
예제 #8
0
 public static CodeNamespace FirstCodeNamespaceOrDefault(this global::EnvDTE.CodeElements codeElements)
 {
     return(codeElements.FirstOrDefault() as CodeNamespace);
 }
예제 #9
0
 public static CodeFunction2 FirstCodeFunction2OrDefault(this global::EnvDTE.CodeElements codeElements)
 {
     return(codeElements.FirstOrDefault() as CodeFunction2);
 }