Esempio n. 1
0
        public void Basic()
        {
            string[] result;
            int      i;
            ValidatedControlConverter conv;

            TypeConverter.StandardValuesCollection values;
            NamingContainer container;
            TextBox         ctl1, ctl2;
            DropDownList    ddl;
            Button          btn;
            ControlTypeDescriptorContext context;

            container = new NamingContainer();
            ctl1      = new TextBox();
            ctl2      = new TextBox();
            ddl       = new DropDownList();

            // Button has no ValidationProperty and will not show in the list
            btn = new Button();

            container.Controls.Add(ctl1);
            container.Controls.Add(ctl2);
            container.Controls.Add(btn);
            container.Controls.Add(ddl);

            container.ID = "naming";
            ctl1.ID      = "fooid";
            ctl2.ID      = "blahid";
            ddl.ID       = "ddlid";
            btn.ID       = "buttonid";

            context = new ControlTypeDescriptorContext(container.Controls);
            conv    = new ValidatedControlConverter();

            values = conv.GetStandardValues(context);
#if NET_2_0
            Assert.IsNull(values, "B1");
#else
            Assert.AreEqual(3, values.Count, "B1");

            result = new string[values.Count];
            i      = 0;
            foreach (string s in values)
            {
                result[i++] = s;
            }

            Assert.AreEqual(new string[] { "blahid", "ddlid", "fooid" }, result, "B2"); // Alphabetical?
            Assert.AreEqual(false, conv.GetStandardValuesExclusive(null), "B3");
            Assert.AreEqual(true, conv.GetStandardValuesSupported(null), "B4");
            Assert.AreEqual(null, conv.GetStandardValues(null), "B5");
#endif
        }
Esempio n. 2
0
        public void Basic()
        {
            string[] result;
            int      i;
            ValidatedControlConverter conv;

            TypeConverter.StandardValuesCollection values;
            NamingContainer container;
            TextBox         ctl1, ctl2;
            DropDownList    ddl;
            Button          btn;
            ControlTypeDescriptorContext context;

            container = new NamingContainer();
            ctl1      = new TextBox();
            ctl2      = new TextBox();
            ddl       = new DropDownList();

            // Button has no ValidationProperty and will not show in the list
            btn = new Button();

            container.Controls.Add(ctl1);
            container.Controls.Add(ctl2);
            container.Controls.Add(btn);
            container.Controls.Add(ddl);

            container.ID = "naming";
            ctl1.ID      = "fooid";
            ctl2.ID      = "blahid";
            ddl.ID       = "ddlid";
            btn.ID       = "buttonid";

            context = new ControlTypeDescriptorContext(container.Controls);
            conv    = new ValidatedControlConverter();

            values = conv.GetStandardValues(context);
            Assert.IsNull(values, "B1");
        }