示例#1
0
        public void EntityMetadata_ctor()
        {
            string fullName = "CalebHunter";
            EntityMetadata entityMetadata = new EntityMetadata(fullName);

            Assert.AreEqual(fullName, entityMetadata.FullName);
        }
示例#2
0
        public void EntityMetadata_BaseClass()
        {
            EntityMetadata parent = new EntityMetadata("Karen");
            EntityMetadata child = new EntityMetadata("Rachel");

            parent.AddClassRelationships(child);

            Assert.AreSame(parent, child.BaseClass);
        }
示例#3
0
        public void EntityMetadata_RootBaseClass()
        {
            EntityMetadata grandparent = new EntityMetadata("Raymond");
            EntityMetadata parent = new EntityMetadata("Harry");
            EntityMetadata child = new EntityMetadata("David");

            grandparent.AddClassRelationships(parent);
            parent.AddClassRelationships(child);

            Assert.AreSame(grandparent, child.RootBaseClass);
            Assert.AreSame(grandparent, parent.RootBaseClass);
            Assert.AreSame(grandparent, grandparent.RootBaseClass, "The grandparent is his own root base class");
        }
示例#4
0
        public void EntityMetadata_IsDescendantOf()
        {
            EntityMetadata grandparent = new EntityMetadata("Jay");
            EntityMetadata parent = new EntityMetadata("Karen");
            EntityMetadata child = new EntityMetadata("Katy");

            grandparent.AddClassRelationships(parent);
            parent.AddClassRelationships(child);

            Assert.True(parent.IsDescendantOf(grandparent.FullName));
            Assert.True(child.IsDescendantOf(grandparent.FullName));
            Assert.False(grandparent.IsDescendantOf(parent.FullName));
            Assert.False(parent.IsDescendantOf(child.FullName));
            Assert.False(grandparent.IsDescendantOf(child.FullName));
        }
示例#5
0
        public void EntityMetadata_Descendants()
        {
            EntityMetadata grandparent = new EntityMetadata("Harry");
            EntityMetadata parent = new EntityMetadata("David");
            EntityMetadata child = new EntityMetadata("Morgen");

            grandparent.AddClassRelationships(parent);
            parent.AddClassRelationships(child);

            List<EntityMetadata> descendants = grandparent.Descendants.ToList();

            Assert.True(descendants.Contains(parent), "Grandparent is missing parent");
            Assert.True(descendants.Contains(child), "Grandparent is missing child");
            Assert.False(descendants.Contains(grandparent), "Grandparent is not a descendant of himself");
        }
示例#6
0
 internal void AddClassRelationships(EntityMetadata derivedClass)
 {
     _DerivedClasses.Add(derivedClass);
     derivedClass.BaseClass = this;
 }
示例#7
0
 internal void AddClassRelationships(EntityMetadata derivedClass)
 {
     _DerivedClasses.Add(derivedClass);
     derivedClass.BaseClass = this;
 }