Exemplo n.º 1
0
        public void PropertyGroupConfigTest()
        {
            PropertyGroupConfigurationElementCollection groups = PropertyGroupSettings.GetConfig().Groups;

            foreach (PropertyGroupConfigurationElement group in groups)
            {
                Console.WriteLine(group.Name);

                foreach (PropertyDefineConfigurationElement property in group.AllProperties)
                {
                    property.Output(Console.Out, 1);
                }
            }
        }
Exemplo n.º 2
0
        public void PropertyGroupWithValidatorTest()
        {
            PropertyGroupConfigurationElementCollection groups = PropertyGroupSettings.GetConfig().Groups;

            foreach (PropertyGroupConfigurationElement group in groups)
            {
                Console.WriteLine(group.Name);

                PropertyDefineCollection propertiesDefinitions = new PropertyDefineCollection();

                propertiesDefinitions.LoadPropertiesFromConfiguration(group);

                foreach (PropertyDefine pd in propertiesDefinitions)
                {
                    pd.Output(Console.Out, 1);
                }
            }
        }
Exemplo n.º 3
0
        public void PropertyValueValidatorTest()
        {
            PropertyGroupConfigurationElementCollection groups = PropertyGroupSettings.GetConfig().Groups;

            foreach (PropertyGroupConfigurationElement group in groups)
            {
                PropertyDefineCollection propertiesDefinitions = new PropertyDefineCollection();

                propertiesDefinitions.LoadPropertiesFromConfiguration(group);

                PropertyValueCollection properties = new PropertyValueCollection();

                properties.AppendFromPropertyDefineCollection(propertiesDefinitions);

                ValidationResults results = properties.Validate();

                Console.WriteLine(results.ToString("\r\n"));
            }
        }
Exemplo n.º 4
0
        public void ValidatorPropertisRegister()
        {
            PropertyGroupSettings settings = PropertyGroupSettings.GetConfig();
            PropertyGroupConfigurationElementCollection groups = settings.Groups;
            List <ValidatorDefine> validatorDefineList         = new List <ValidatorDefine>();

            foreach (PropertyGroupConfigurationElement element in groups)
            {
                PropertyValueCollection  pvc = new PropertyValueCollection();
                PropertyDefineCollection pdc = new PropertyDefineCollection();
                pdc.LoadPropertiesFromConfiguration(element);
                pvc.InitFromPropertyDefineCollection(pdc);
                validatorDefineList.Add(new ValidatorDefine {
                    ValidatorName = element.Name, PropertyValues = pvc
                });
            }
            string script = string.Format("var arrValidatorDefine={0};", JSONSerializerExecute.Serialize(validatorDefineList));

            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "RegisterValidatorDefineScript", script, true);
        }