public void Setup() { m_worldModel = new WorldModel(); a = m_worldModel.GetElementFactory(ElementType.Object).Create("a"); b = m_worldModel.GetElementFactory(ElementType.Object).Create("b"); c = m_worldModel.GetElementFactory(ElementType.Object).Create("c"); }
public void TestListExtension_InheritingDirectly() { WorldModel worldModel = new WorldModel(); Element type1 = worldModel.GetElementFactory(ElementType.ObjectType).Create("type1"); type1.Fields.AddFieldExtension("listfield", new QuestList<string>(new[] { "a" }, true)); Element type2 = worldModel.GetElementFactory(ElementType.ObjectType).Create("type2"); type2.Fields.AddType(type1); type2.Fields.AddFieldExtension("listfield", new QuestList<string>(new[] { "b" }, true)); Element obj = worldModel.GetElementFactory(ElementType.Object).Create("object"); obj.Fields.AddType(type2); var result = obj.Fields.GetAsType<QuestList<string>>("listfield"); Assert.AreEqual(2, result.Count); Assert.IsTrue(result.Contains("a")); Assert.IsTrue(result.Contains("b")); }
public void Setup() { m_worldModel = new WorldModel(); m_object = m_worldModel.GetElementFactory(ElementType.Object).Create("object"); var list = new QuestList<object> {"string1"}; var dictionary = new QuestDictionary<object> {{"key1", "nested string"}}; list.Add(dictionary); m_object.Fields.Set("list", list); m_object.Fields.Resolve(null); }
public void Setup() { m_worldModel = new WorldModel(); m_original = m_worldModel.GetElementFactory(ElementType.Object).Create("original"); m_original.Fields.Set(attributeName, attributeValue); m_original.Fields.Set(listAttributeName, new QuestList<string>(listAttributeValue)); m_original.Fields.Resolve(null); Assert.AreEqual(attributeValue, m_original.Fields.GetString(attributeName)); Assert.AreEqual(3, m_original.Fields.GetAsType<QuestList<string>>(listAttributeName).Count); }
public void Setup() { const string inheritedTypeName = "inherited"; const string subInheritedTypeName = "subtype"; const string defaultObject = "defaultobject"; m_worldModel = new WorldModel(); m_defaultType = m_worldModel.GetElementFactory(ElementType.ObjectType).Create(defaultObject); m_defaultType.Fields.Set(attributeDefinedByDefaultName, attributeDefinedByDefaultValue); m_defaultType.Fields.Set(attributeDefinedByDefault2Name, attributeDefinedByDefault2Value); m_subType = m_worldModel.GetElementFactory(ElementType.ObjectType).Create(subInheritedTypeName); m_subType.Fields.Set(inheritedAttribute2Name, inheritedAttribute2Value); m_subType.Fields.Set(attributeDefinedByDefault2Name, attributeDefinedByDefault2OverriddenValue); m_objectType = m_worldModel.GetElementFactory(ElementType.ObjectType).Create(inheritedTypeName); m_objectType.Fields.Set(inheritedAttributeName, inheritedAttributeValue); m_objectType.Fields.AddType(m_subType); m_object = m_worldModel.GetElementFactory(ElementType.Object).Create("object"); m_object.Fields.Resolve(null); m_object.Fields.AddType(m_objectType); }
public void Setup() { m_worldModel = new WorldModel(); // a // - b // - c // - d // - e // f Element a = m_worldModel.GetElementFactory(ElementType.Object).Create("a"); Element b = m_worldModel.GetElementFactory(ElementType.Object).Create("b"); b.Parent = a; Element c = m_worldModel.GetElementFactory(ElementType.Object).Create("c"); c.Parent = b; Element d = m_worldModel.GetElementFactory(ElementType.Object).Create("d"); d.Parent = b; Element e = m_worldModel.GetElementFactory(ElementType.Object).Create("e"); e.Parent = a; Element f = m_worldModel.GetElementFactory(ElementType.Object).Create("f"); }