public void EntOneProp_KString_VDouble()
        {
            EtagairCore core = Common.CreateCore(RepositConfig);

            // create an entity template to instantiate
            EntityTempl templComputer = core.EditorTempl.CreateEntityTempl("TemplComputer");

            // add property
            core.EditorTempl.CreatePropTempl(templComputer, "Count", 12.0);

            //====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
            ValDouble propValueDouble = prop.Value as ValDouble;

            Assert.IsNotNull(propValueDouble, "the prop key double Count should exists");
            Assert.AreEqual(12.0, propValueDouble.Value, "the value should be 12.0");
        }
Пример #2
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, double value)
        {
            // create the property value
            ValDouble valDouble = new ValDouble();

            valDouble.Value = value;

            return(CreateProperty(entity, propertyParent, tcKey, valDouble));
        }
Пример #3
0
        public void CreateEntity_Prop_KeyString_ValDouble()
        {
            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, "Value", 12.5);

            // check the property key (type and value)
            PropertyKeyString propKeyString = propName.Key as PropertyKeyString;

            Assert.IsNotNull(propKeyString, "the key should be a string");
            Assert.AreEqual("Value", propKeyString.Key, "the key should be 'Value'");

            // check the property value (type and value)
            ValDouble propValueDouble = propName.Value as ValDouble;

            Assert.IsNotNull(propValueDouble, "the value should be a  double");
            Assert.AreEqual(12.5, propValueDouble.Value, "the key should be 12.5");
        }
Пример #4
0
        public void CreateEntity_Prop_KeyTextCode_ValDouble()
        {
            EtagairCore core = Common.CreateCore(RepositConfig);

            TextCode tcName = core.Editor.CreateTextCode("Power");

            // create an ent
            Entity toshibaCoreI7 = core.Editor.CreateEntity();

            // Add a property to an object: key - value
            Property propName = core.Editor.CreateProperty(toshibaCoreI7, tcName, 12.0);

            // 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)
            ValDouble propValueDouble = propName.Value as ValDouble;

            Assert.IsNotNull(propValueDouble, "the value should be a double");
            Assert.AreEqual(12, propValueDouble.Value, "the value should be 12.0");
        }