コード例 #1
0
        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);
        }
コード例 #2
0
        public void Reflex_GetPropertiesNameAndValueWithAttributes_object_null_ArrayType_ret_null()
        {
            // Prepara
            ClasePruebaPropiedadesFields objeto = null;

            // Ejecuta
            Dictionary <string, object> dicProperties = Reflex.GetPropertiesNameAndValueWithAttributes(objeto, typeof(FieldAttribute));

            // Comprueba
            Assert.IsNull(dicProperties);
        }
コード例 #3
0
        public void Reflex_GetPropertiesInfo_object_null_ret_null()
        {
            // Prepara
            ClasePruebaPropiedadesFields objeto = null;

            // Ejecuta
            List <PropertyInfo> pis = Reflex.GetPropertiesInfo(objeto);

            // Comprueba
            Assert.IsNull(pis);
        }
コード例 #4
0
        public void Reflex_GetPropertiesNameAndValueWithAttributes_object_sinLosAtributos_ArrayType_ret_null()
        {
            // Prepara
            ClasePruebaPropiedadesFields objeto = new ClasePruebaPropiedadesFields
            {
                FieldBool = true,
                FieldDT   = DateTime.MinValue,
                FieldInt  = 0,
                FieldStr  = string.Empty
            };

            // Ejecuta
            Dictionary <string, object> dicProperties = Reflex.GetPropertiesNameAndValueWithAttributes(objeto, typeof(KeyAttribute));

            // Comprueba
            Assert.IsNull(dicProperties);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        public void Reflex_GetPropertiesNameAndValue_object_null_ListPIs_ret_null()
        {
            // Prepara
            ClasePruebaPropiedadesFields nullObject = null;
            ClasePruebaPropiedadesFields objeto     = new ClasePruebaPropiedadesFields
            {
                FieldBool = false,
                FieldDT   = DateTime.MinValue,
                FieldInt  = 0,
                FieldStr  = string.Empty
            };
            List <PropertyInfo> pis = Reflex.GetPropertiesInfoWithAttributes(objeto, typeof(FieldAttribute));

            // Ejecuta
            Dictionary <string, object> dicProperties = Reflex.GetPropertiesNameAndValue(nullObject, pis);

            // Comprueba
            Assert.IsNull(dicProperties);
        }
コード例 #7
0
        public void Reflex_GetPropertiesNameAndValueWithAttributes_object_ArrayType_ret_Dictionary_str_object()
        {
            // Prepara
            DateTime dtAhora = DateTime.Now;
            ClasePruebaPropiedadesFields objeto = new ClasePruebaPropiedadesFields
            {
                FieldBool = true,
                FieldDT   = dtAhora,
                FieldInt  = 115,
                FieldStr  = "Hello World!"
            };

            // Ejecuta
            Dictionary <string, object> dicProperties = Reflex.GetPropertiesNameAndValueWithAttributes(objeto, typeof(FieldAttribute));

            // 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"]);
        }
コード例 #8
0
        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);
        }