Beispiel #1
0
        public void CannotRemoveInheritedAttribute()
        {
            Entity parent = new Entity() { Name = "parent" };
            parent.AddAttribute(new Attribute("test"));

            Entity child = new Entity();
            child.AddPrototype(parent);

            Attribute childAttribute = child.GetAttribute("test");
            child.RemoveAttribute(childAttribute);

            Assert.AreEqual(1, child.Attributes.Where(x => x.Name == "test").Count());
        }
Beispiel #2
0
        public void RemoveLocalAttribute()
        {
            Entity entity = new Entity();

            Attribute attribute = new Attribute("test");
            entity.AddAttribute(attribute);
            entity.RemoveAttribute(attribute);

            Assert.AreEqual(0, entity.Attributes.Where(x => x.Name == "test").Count());
        }
Beispiel #3
0
        public void AttributeBecomesNonInheritableAfterRemoveFromParent()
        {
            Entity parent = new Entity() { Name = "parent" };

            Attribute attribute = new Attribute("test") { Value = new Value("value") };
            parent.AddAttribute(attribute);

            Entity child = new Entity();
            child.AddPrototype(parent);

            Attribute childAttribute = child.GetAttribute("test");
            //childAttribute.IsInherited = false;
            childAttribute.Value = new Value("new value");

            //Assert.IsTrue(childAttribute.CanInherit);

            parent.RemoveAttribute(attribute);

            //Assert.IsFalse(childAttribute.CanInherit);
            Assert.AreEqual(0, parent.Attributes.Count);
            Assert.AreEqual(1, child.Attributes.Count);
        }