コード例 #1
0
        public void PetshopNamespaces()
        {
            Assert.AreEqual(7, codeModel.Namespaces.Count);

            CCNamespace rootByName = codeModel.GetNamespaceByName("Petshop");

            Assert.IsNotNull(rootByName);
            Assert.AreEqual(4, rootByName.Namespaces.Count);

            CCNamespace rootByParentNull = codeModel.GetRootNamespaces()[0];

            Assert.AreEqual("Petshop", rootByParentNull.Name);
            Assert.AreEqual(4, rootByParentNull.Namespaces.Count);
            Assert.AreEqual(rootByName, rootByParentNull);

            CCNamespace messaging = codeModel.GetNamespaceByName("Petshop.Messaging");

            Assert.IsNotNull(messaging);
            Assert.AreEqual(1, messaging.Namespaces.Count);

            CCNamespace email         = codeModel.GetNamespaceByName("Petshop.Messaging.Email");
            CCNamespace rootFromEmail = email.Parent.Parent;

            Assert.IsNotNull(rootFromEmail);
            Assert.AreEqual(rootByName, rootFromEmail);
        }
コード例 #2
0
        public static GoCityNode Convert(CodeModel codeModel)
        {
            var root = new GoCityNode
            {
                Name = codeModel.Name,
            };

            foreach (var ns in codeModel.GetRootNamespaces())
            {
                root.Children.Add(CreateGoCityNode(ns));
            }
            root.GenerateChildrenPosition();
            return(root);
        }