Exemple #1
0
        public void ControlPropertiesValid1()
        {
            BaseValidatorPoker p = new BaseValidatorPoker();

            StartValidationTest(p);
            TextBox box = SetValidationTextBox("textbox", "hello world");

            Assert.IsTrue(p.DoControlPropertiesValid(), "B1");

            StopValidationTest();
        }
Exemple #2
0
        public void ControlPropertiesValid3()
        {
            BaseValidatorPoker p = new BaseValidatorPoker();

            StartValidationTest(p);

            p.ControlToValidate = "textbox";

            /* failure (exception) due to unknown control */
            p.DoCheckControlValidationProperty("textbox", "Text2");

            StopValidationTest();
        }
Exemple #3
0
        public void ControlPropertiesValid2()
        {
            BaseValidatorPoker p = new BaseValidatorPoker();

            StartValidationTest(p);
            TextBox box = AddTextBox("textbox", "hello world");

            /* successful */
            p.DoCheckControlValidationProperty("textbox", "Text");

            /* failure (exception) due to unknown control */
            p.DoCheckControlValidationProperty("textbox2", "Text");

            StopValidationTest();
        }
Exemple #4
0
        public void NullValidationProperty()
        {
            BaseValidatorPoker v = new BaseValidatorPoker();

            Page p = new Page();

            p.Controls.Add(v);
            RadioButtonList l = new RadioButtonList();

            p.Controls.Add(l);
            l.ID = "XXX";
            v.ControlToValidate = "XXX";

            Assert.AreEqual(String.Empty, v.DoGetControlValidationValue("XXX"), "#A1");
        }
Exemple #5
0
        public void ValidationProperty()
        {
            BaseValidatorPoker p = new BaseValidatorPoker();
            PropertyDescriptor d;

            StartValidationTest(p);

            TextBox box = AddTextBox("textbox", "hello world");

            d = p.GetValidationProperty(box);
            Assert.AreEqual("Text", d.Name, "A1");
            Assert.AreEqual("hello world", p.DoGetControlValidationValue("textbox"), "A2");

            StopValidationTest();
        }
Exemple #6
0
        public void GetControlValidationValue()
        {
            BaseValidatorPoker p = new BaseValidatorPoker();

            StartValidationTest(p);
            TextBox box   = AddTextBox("textbox", "hello world");
            Label   label = new Label();

            label.ID = "label";

            Page.Controls.Add(label);

            /* successful */
            Assert.AreEqual("hello world", p.DoGetControlValidationValue("textbox"), "C1");

            /* failure (non-existant control)*/
            Assert.IsNull(p.DoGetControlValidationValue("textbox2"), "C2");

            /* failure (control without a ValidationProperty */
            Assert.IsNull(p.DoGetControlValidationValue("label"), "C3");

            StopValidationTest();
        }
Exemple #7
0
        public void ViewState()
        {
            BaseValidatorPoker p = new BaseValidatorPoker();

            /* defaults */
            Assert.AreEqual(String.Empty, p.ControlToValidate, "D1");
            Assert.AreEqual(ValidatorDisplay.Static, p.Display, "D2");
            Assert.AreEqual(true, p.EnableClientScript, "D3");
            Assert.AreEqual(true, p.Enabled, "D4");
            Assert.AreEqual(String.Empty, p.ErrorMessage, "D5");
            Assert.AreEqual(Color.Red, p.ForeColor, "D6");
            Assert.AreEqual(true, p.IsValid, "D7");

            /* get/set */
            p.ControlToValidate = "foo";
            Assert.AreEqual("foo", p.ControlToValidate, "D8");

            p.Display = ValidatorDisplay.Dynamic;
            Assert.AreEqual(ValidatorDisplay.Dynamic, p.Display, "D9");

            p.EnableClientScript = false;
            Assert.AreEqual(false, p.EnableClientScript, "D9");

            p.Enabled = false;
            Assert.AreEqual(false, p.Enabled, "D10");

            p.ErrorMessage = "stupid monkey";
            Assert.AreEqual("stupid monkey", p.ErrorMessage, "D11");

            p.ForeColor = Color.Blue;
            Assert.AreEqual(Color.Blue, p.ForeColor, "D12");
            //XXX add check to see if setting the color alters the style at all.

            p.IsValid = false;
            Assert.AreEqual(false, p.IsValid, "D13");
        }
Exemple #8
0
        public void BasicExceptionTest()
        {
            BaseValidatorPoker p = new BaseValidatorPoker();

            p.CheckControlProperties();
        }
Exemple #9
0
		public void GetControlValidationValue ()
		{
			BaseValidatorPoker p = new BaseValidatorPoker ();

			StartValidationTest (p);
			TextBox box = AddTextBox ("textbox", "hello world");
			Label label = new Label ();

			label.ID = "label";

			Page.Controls.Add (label);

			/* successful */
			Assert.AreEqual ("hello world", p.DoGetControlValidationValue ("textbox"), "C1");

			/* failure (non-existant control)*/
			Assert.IsNull (p.DoGetControlValidationValue ("textbox2"), "C2");

			/* failure (control without a ValidationProperty */
			Assert.IsNull (p.DoGetControlValidationValue ("label"), "C3");

			StopValidationTest ();
		}
Exemple #10
0
		public void ControlPropertiesValid3 ()
		{
			BaseValidatorPoker p = new BaseValidatorPoker ();

			StartValidationTest (p);

			p.ControlToValidate = "textbox";

			/* failure (exception) due to unknown control */
			p.DoCheckControlValidationProperty ("textbox", "Text2");

			StopValidationTest ();
		}
Exemple #11
0
		public void BasicExceptionTest () {
			BaseValidatorPoker p = new BaseValidatorPoker ();

			p.CheckControlProperties();
		}
Exemple #12
0
		public void ControlPropertiesValid2 ()
		{
			BaseValidatorPoker p = new BaseValidatorPoker ();

			StartValidationTest (p);
			TextBox box = AddTextBox ("textbox", "hello world");

			/* successful */
			p.DoCheckControlValidationProperty ("textbox", "Text");

			/* failure (exception) due to unknown control */
			p.DoCheckControlValidationProperty ("textbox2", "Text");

			StopValidationTest ();
		}
Exemple #13
0
		public void NullValidationProperty ()
		{
			BaseValidatorPoker v = new BaseValidatorPoker ();

			Page p = new Page ();
			p.Controls.Add (v);
			RadioButtonList l = new RadioButtonList ();
			p.Controls.Add (l);
			l.ID = "XXX";
			v.ControlToValidate = "XXX";

			Assert.AreEqual (String.Empty, v.DoGetControlValidationValue ("XXX"), "#A1");
		}
Exemple #14
0
		public void ControlPropertiesValid1 ()
		{
			BaseValidatorPoker p = new BaseValidatorPoker ();

			StartValidationTest (p);
			TextBox box = SetValidationTextBox ("textbox", "hello world");

			Assert.IsTrue (p.DoControlPropertiesValid (), "B1");

			StopValidationTest ();
		}
Exemple #15
0
		public void ValidationProperty ()
		{
			BaseValidatorPoker p = new BaseValidatorPoker ();
			PropertyDescriptor d;

			StartValidationTest (p);

			TextBox box = AddTextBox ("textbox", "hello world");

			d = p.GetValidationProperty (box);
			Assert.AreEqual ("Text", d.Name, "A1");
			Assert.AreEqual ("hello world", p.DoGetControlValidationValue ("textbox"), "A2");

			StopValidationTest ();
		}
Exemple #16
0
		public void ViewState ()
		{
			BaseValidatorPoker p = new BaseValidatorPoker ();

			/* defaults */
			Assert.AreEqual (String.Empty, p.ControlToValidate, "D1");
			Assert.AreEqual (ValidatorDisplay.Static, p.Display, "D2");
			Assert.AreEqual (true, p.EnableClientScript, "D3");
			Assert.AreEqual (true, p.Enabled, "D4");
			Assert.AreEqual (String.Empty, p.ErrorMessage, "D5");
			Assert.AreEqual (Color.Red, p.ForeColor, "D6");
			Assert.AreEqual (true, p.IsValid, "D7");

			/* get/set */
			p.ControlToValidate = "foo";
			Assert.AreEqual ("foo", p.ControlToValidate, "D8");

			p.Display = ValidatorDisplay.Dynamic;
			Assert.AreEqual (ValidatorDisplay.Dynamic, p.Display, "D9");

			p.EnableClientScript = false;
			Assert.AreEqual (false, p.EnableClientScript, "D9");

			p.Enabled = false;
			Assert.AreEqual (false, p.Enabled, "D10");

			p.ErrorMessage = "stupid monkey";
			Assert.AreEqual ("stupid monkey", p.ErrorMessage, "D11");

			p.ForeColor = Color.Blue;
			Assert.AreEqual (Color.Blue, p.ForeColor, "D12");
			//XXX add check to see if setting the color alters the style at all.

			p.IsValid = false;
			Assert.AreEqual (false, p.IsValid, "D13");
		}