public void Reflex_GetPropertiesInfoWithAttributes_object_null_ArrayType_ret_null() { // Prepara ClasePruebaPropiedadesFields objeto = null; // Ejecuta List <PropertyInfo> pis = Reflex.GetPropertiesInfoWithAttributes(objeto, typeof(FieldAttribute)); // Comprueba Assert.IsNull(pis); }
public void Reflex_GetPropertiesNameAndValue_object_sinPropiedades_ListPIs_null_ret_null() { // Prepara ClasePruebaSinPropiedades objeto = new ClasePruebaSinPropiedades { Field = null }; List <PropertyInfo> pis = Reflex.GetPropertiesInfoWithAttributes(objeto, typeof(FieldAttribute)); // Ejecuta Dictionary <string, object> dicProperties = Reflex.GetPropertiesNameAndValue(objeto, pis); // Comprueba Assert.IsNull(dicProperties); }
public void Reflex_GetPropertiesInfoWithAttributes_object_sinLosAtributos_ArrayType_ret_null() { // Prepara ClasePruebaPropiedadesFields objeto = new ClasePruebaPropiedadesFields { FieldBool = true, FieldDT = DateTime.MinValue, FieldInt = 0, FieldStr = string.Empty }; // Ejecuta List <PropertyInfo> pis = Reflex.GetPropertiesInfoWithAttributes(objeto, typeof(KeyAttribute)); // Comprueba Assert.IsNull(pis); }
public void Reflex_GetPropertiesNameAndValue_object_sinLosAtributos_ListPIs_null_ret_null() { // Prepara ClasePruebaPropiedadesFields objeto = new ClasePruebaPropiedadesFields { FieldBool = true, FieldDT = DateTime.MinValue, FieldInt = 0, FieldStr = string.Empty }; List <PropertyInfo> pis = Reflex.GetPropertiesInfoWithAttributes(objeto, typeof(KeyAttribute)); // Ejecuta Dictionary <string, object> dicProperties = Reflex.GetPropertiesNameAndValue(objeto, pis); // Comprueba Assert.IsNull(dicProperties); }
public void Reflex_GetPropertiesInfoWithAttributes_object_ArrayType_ret_ListPI() { // Prepara ClasePruebaPropiedadesFields objeto = new ClasePruebaPropiedadesFields { FieldBool = true, FieldDT = DateTime.MinValue, FieldInt = 0, FieldStr = string.Empty }; // Ejecuta List <PropertyInfo> pis = Reflex.GetPropertiesInfoWithAttributes(objeto, typeof(FieldAttribute)); // Comprueba List <string> nombresProp = pis.ConvertAll(pi => pi.Name); Assert.IsTrue(nombresProp.IndexOf("FieldBool") >= 0); Assert.IsTrue(nombresProp.IndexOf("FieldDT") >= 0); Assert.IsTrue(nombresProp.IndexOf("FieldInt") >= 0); Assert.IsTrue(nombresProp.IndexOf("FieldStr") >= 0); }
public void Reflex_GetPropertiesNameAndValue_object_ListPIs_ret_Dictionary_str_object() { // Prepara DateTime dtAhora = DateTime.Now; ClasePruebaPropiedadesFields objeto = new ClasePruebaPropiedadesFields { FieldBool = true, FieldDT = dtAhora, FieldInt = 115, FieldStr = "Hello World!" }; List <PropertyInfo> pis = Reflex.GetPropertiesInfoWithAttributes(objeto, typeof(FieldAttribute)); // Ejecuta Dictionary <string, object> dicProperties = Reflex.GetPropertiesNameAndValue(objeto, pis); // Comprueba Assert.AreEqual(true, (bool)dicProperties["FieldBool"]); Assert.AreEqual(dtAhora, (DateTime)dicProperties["FieldDT"]); Assert.AreEqual(115, (int)dicProperties["FieldInt"]); Assert.AreEqual("Hello World!", (string)dicProperties["FieldStr"]); }