예제 #1
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);
        }
예제 #2
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);
        }
예제 #3
0
        public void Reflex_GetPropertiesNameAndValueWithAttributes_object_variosAtributos_ArrayType_ret_Dictionary_str_object()
        {
            // Prepara
            DateTime            dtAhora = DateTime.Now;
            ClasePruebaKeyField objeto  = new ClasePruebaKeyField
            {
                FieldBool = true,
                FieldDT   = dtAhora,
                FieldInt  = 115,
                FieldStr  = "Hello World!"
            };

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

            // Comprueba
            Assert.AreEqual(true, (bool)dicProperties["FieldBool"]);
            Assert.IsFalse(dicProperties.ContainsKey("FieldDT"));
            Assert.IsFalse(dicProperties.ContainsKey("FieldInt"));
            Assert.AreEqual("Hello World!", (string)dicProperties["FieldStr"]);
        }
예제 #4
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"]);
        }