public void EntOneProp_KString_VBool() { EtagairCore core = Common.CreateCore(RepositConfig); // create an entity template to instantiate EntityTempl templComputer = core.EditorTempl.CreateEntityTempl("TemplComputer"); // add property core.EditorTempl.CreatePropTempl(templComputer, "Count", true); //====Instanciate the template, create an entity, under the root folder EntityTemplToInst templToInst = core.ProcessTempl.CreateEntity(templComputer); //====check that the execution finishes with success Assert.AreEqual(TemplToInstState.Success, templToInst.State, "the state should be sucess"); Assert.AreEqual(TemplToInstStep.Ends, templToInst.NextStep, "the next step should be ends"); // check, get the key property: Count PropertyBase propBase = core.Searcher.FindPropertyByKey(templToInst.Entity, templToInst.Entity.PropertyRoot, "Count", false); Property prop = propBase as Property; //----check the prop key, is: Count PropertyKeyString propKeyString = prop.Key as PropertyKeyString; Assert.IsNotNull(propKeyString, "the prop key string Type should exists"); Assert.AreEqual("Count", propKeyString.Key, "the key should be Count"); // check the prop value ValBool propValueBool = prop.Value as ValBool; Assert.IsNotNull(propValueBool, "the prop key bool Count should exists"); Assert.AreEqual(true, propValueBool.Value, "the value should be 12.0"); }
/// <summary> /// Create a property to an object: key - value, /// </summary> /// <param name="entity"></param> /// <param name="tcKey"></param> /// <param name="tcValue"></param> /// <returns></returns> public Property CreateProperty(Entity entity, PropertyGroup propertyParent, TextCode tcKey, bool value) { // create the property value ValBool valBool = new ValBool(); valBool.Value = value; return(CreateProperty(entity, propertyParent, tcKey, valBool)); }
public void CreateEntity_Prop_KeyString_ValBool() { EtagairCore core = Common.CreateCore(RepositConfig); // create an ent Entity toshibaCoreI7 = core.Editor.CreateEntity(); // Add a property to an object: key - value Property propName = core.Editor.CreateProperty(toshibaCoreI7, "Done", true); // check the property key (type and value) PropertyKeyString propKeyString = propName.Key as PropertyKeyString; Assert.IsNotNull(propKeyString, "the key should be a string"); Assert.AreEqual("Done", propKeyString.Key, "the key should be 'Value'"); // check the property value (type and value) ValBool propValueBool = propName.Value as ValBool; Assert.IsNotNull(propValueBool, "the value should be a bool"); Assert.AreEqual(true, propValueBool.Value, "the key should be true"); }
public void CreateEntity_Prop_KeyTextCode_ValBool() { EtagairCore core = Common.CreateCore(RepositConfig); TextCode tcName = core.Editor.CreateTextCode("On"); // create an ent Entity toshibaCoreI7 = core.Editor.CreateEntity(); // Add a property to an object: key - value Property propName = core.Editor.CreateProperty(toshibaCoreI7, tcName, true); // check the property key (type and value) PropertyKeyTextCode propKeyTextCode = propName.Key as PropertyKeyTextCode; Assert.IsNotNull(propKeyTextCode, "the key should be a TextCode"); Assert.AreEqual(tcName.Id, propKeyTextCode.TextCodeId, "the key should be 'Name'"); // check the property value (type and value) ValBool propValueBool = propName.Value as ValBool; Assert.IsNotNull(propValueBool, "the value should be a bool"); Assert.AreEqual(true, propValueBool.Value, "the value should be 15"); }