public void Property_Set() { // Age test ]=======================================================// var lassie = new Types_ClassInfo_Dog_Bulldog(1); Assert.Equal(1, lassie.Age); lassie.BirhthDay(); Assert.Equal(2, lassie.Age); // Owner test]======================================================// Assert.Equal("", lassie.OwnderName); _lamed.Types.Class.ClassInfo.Property_Set(lassie, "OwnderName", "Jan"); object Object = _lamed.Types.Class.ClassInfo.Property_Get(lassie, "OwnderName"); string valueStr = _lamed.Types.Class.ClassInfo.Property_Get <string>(lassie, "OwnderName"); Assert.Equal("Jan", Object); Assert.Equal("Jan", valueStr); lassie.OwnderName = "Piet"; Object = _lamed.Types.Class.ClassInfo.Property_Get(lassie, "OwnderName"); Assert.Equal("Piet", Object); Assert.Equal(enSpecies.Dog, lassie.Species); _lamed.Types.Class.ClassInfo.Property_Set(lassie, "Species", enSpecies.Unknown); Assert.Equal(enSpecies.Unknown, lassie.Species); // =================================================================// }
public void Field_Set() { // Age test ]================================================ var lassie = new Types_ClassInfo_Dog_Bulldog(1); Assert.Equal(1, lassie.Age); lassie.BirhthDay(); Assert.Equal(2, lassie.Age); FieldInfo fieldInfo = _lamed.Types.Class.ClassInfo.Field_AsFieldInfo(lassie.GetType(), "Age"); // See if we can get this field Assert.True(fieldInfo != null); _lamed.Types.Class.ClassInfo.Field_Set(lassie, "Age", 10); object value = _lamed.Types.Class.ClassInfo.Field_Get(lassie, "Age"); int valueInt = _lamed.Types.Class.ClassInfo.Field_Get <int>(lassie, "Age"); Assert.Equal(10, lassie.Age); Assert.Equal(10, value); Assert.Equal(10, valueInt); }