public void DefaultsNotWorking()
        {
            CustomValidatorTestClass c = new CustomValidatorTestClass();

#if NET_2_0
            Assert.AreEqual(false, c.ValidateEmptyText, "ValidateEmptyText");
#endif
        }
Exemple #2
0
        public void EmptyControlName()
        {
            Page     page = new Page();
            HtmlForm form = new HtmlForm();
            CustomValidatorTestClass tc = new CustomValidatorTestClass();

            page.Controls.Add(form);
            form.Controls.Add(tc);
            Assert.IsTrue(tc.AreControlPropertiesValid(), "#01");
        }
Exemple #3
0
        public void Defaults()
        {
            CustomValidatorTestClass c;

            c = new CustomValidatorTestClass();
            Assert.AreEqual(string.Empty, c.ClientValidationFunction, "D1");

            c.ClientValidationFunction = "Hurra, hurra, die Schule brennt";
            Assert.AreEqual("Hurra, hurra, die Schule brennt", c.ClientValidationFunction, "D1");
        }
Exemple #4
0
        public void Render()
        {
            CustomValidatorTestClass c;
            TextBox t;

            c = new CustomValidatorTestClass();
            StartValidationTest(c);
            t = SetValidationTextBox("textbox", "3");
            c.Validate();
            c.ErrorMessage    = "aw shucks";
            c.Display         = ValidatorDisplay.Static;
            c.Enabled         = true;
            c.EnableViewState = true;


            c.ClientValidationFunction = "Father to a sister of thought";
        }
Exemple #5
0
        public void ValidateEmptyText()
        {
            CustomValidatorTestClass c = new CustomValidatorTestClass();
            Page    p  = new Page();
            TextBox tb = new TextBox();

            tb.ID = "tb";

            CustomValidator v = new CustomValidator();

            v.ServerValidate   += new ServerValidateEventHandler(ServerValidate);
            v.ControlToValidate = "tb";
            p.Controls.Add(tb);
            p.Controls.Add(v);

            v.Validate();
            Assert.AreEqual(false, checker, "Validate with ValidateEmptyText = false");
            v.ValidateEmptyText = true;
            v.Validate();
            Assert.AreEqual(true, checker, "Validate with ValidateEmptyText = true");
        }
Exemple #6
0
        public void EventDefaults()
        {
            CustomValidatorTestClass c;
            TextBox t;

            c = new CustomValidatorTestClass();

            Assert.AreEqual(true, c.Evaluate(), "E1");
            Assert.AreEqual(false, bool_result, "E2");

            c.ServerValidate += new ServerValidateEventHandler(ServerValidateMethod);
            bool_result       = false;

            Assert.AreEqual(true, c.Evaluate(), "E3");
            Assert.AreEqual(true, bool_result, "E4");

            StartValidationTest(c);
            t           = SetValidationTextBox("textbox", "3");
            bool_result = false;

            Assert.AreEqual(true, c.Evaluate(), "E5");
            Assert.AreEqual(true, bool_result, "E6");
        }
        public void Render()
        {
            CustomValidatorTestClass c;
            TextBox t;

            c = new CustomValidatorTestClass();
            StartValidationTest(c);
            t = SetValidationTextBox("textbox", "3");
            c.Validate();
            c.ErrorMessage    = "aw shucks";
            c.Display         = ValidatorDisplay.Static;
            c.Enabled         = true;
            c.EnableViewState = true;

#if !NET_2_0
            Assert.AreEqual("<span style=\"color:Red;\">aw shucks</span>", c.Render(), "R1");
#endif

            c.ClientValidationFunction = "Father to a sister of thought";
#if !NET_2_0
            Assert.AreEqual("<span style=\"color:Red;\">aw shucks</span>", c.Render(), "R2");
#endif
        }
Exemple #8
0
		public void EmptyControlName ()
		{
			Page page = new Page ();
			HtmlForm form = new HtmlForm ();
			CustomValidatorTestClass tc = new CustomValidatorTestClass ();
			page.Controls.Add (form);
			form.Controls.Add (tc);
			Assert.IsTrue (tc.AreControlPropertiesValid (), "#01");
		}
Exemple #9
0
		public void Render () {
			CustomValidatorTestClass	c;
			TextBox				t;

			c = new CustomValidatorTestClass();
			StartValidationTest(c);
			t = SetValidationTextBox("textbox", "3");
			c.Validate();
			c.ErrorMessage = "aw shucks";
			c.Display = ValidatorDisplay.Static;
			c.Enabled = true;
			c.EnableViewState = true;

#if! NET_2_0
			Assert.AreEqual("<span style=\"color:Red;\">aw shucks</span>", c.Render(), "R1");
#endif

			c.ClientValidationFunction = "Father to a sister of thought";
#if! NET_2_0
			Assert.AreEqual("<span style=\"color:Red;\">aw shucks</span>", c.Render(), "R2");
#endif
		}
Exemple #10
0
		public void ValidateEmptyText ()
		{
			CustomValidatorTestClass c = new CustomValidatorTestClass ();
			Page p = new Page ();
			TextBox tb = new TextBox ();
			tb.ID = "tb";
			
			CustomValidator v = new CustomValidator ();
			v.ServerValidate += new ServerValidateEventHandler (ServerValidate);
			v.ControlToValidate = "tb";
			p.Controls.Add (tb);
			p.Controls.Add (v);

			v.Validate ();
			Assert.AreEqual (false, checker, "Validate with ValidateEmptyText = false");
			v.ValidateEmptyText = true;
			v.Validate ();
			Assert.AreEqual (true, checker, "Validate with ValidateEmptyText = true");
		}
Exemple #11
0
		public void DefaultsNotWorking ()
		{
			CustomValidatorTestClass c = new CustomValidatorTestClass ();
#if NET_2_0
			Assert.AreEqual (false, c.ValidateEmptyText, "ValidateEmptyText");
#endif
		}
Exemple #12
0
		public void Defaults () {
			CustomValidatorTestClass	c;

			c= new CustomValidatorTestClass();
			Assert.AreEqual(string.Empty, c.ClientValidationFunction , "D1");

			c.ClientValidationFunction = "Hurra, hurra, die Schule brennt";
			Assert.AreEqual("Hurra, hurra, die Schule brennt", c.ClientValidationFunction , "D1");
		}
Exemple #13
0
		public void EventDefaults ()
		{
			CustomValidatorTestClass	c;
			TextBox				t;

			c = new CustomValidatorTestClass();

			Assert.AreEqual(true, c.Evaluate(), "E1");
			Assert.AreEqual(false, bool_result, "E2");

			c.ServerValidate += new ServerValidateEventHandler(ServerValidateMethod);
			bool_result = false;

			Assert.AreEqual(true, c.Evaluate(), "E3");
			Assert.AreEqual(true, bool_result, "E4");

			StartValidationTest(c);
			t = SetValidationTextBox("textbox", "3");
			bool_result = false;

			Assert.AreEqual(true, c.Evaluate(), "E5");
			Assert.AreEqual(true, bool_result, "E6");
		}
		public void Render () {
			CustomValidatorTestClass	c;
			TextBox				t;

			c = new CustomValidatorTestClass();
			StartValidationTest(c);
			t = SetValidationTextBox("textbox", "3");
			c.Validate();
			c.ErrorMessage = "aw shucks";
			c.Display = ValidatorDisplay.Static;
			c.Enabled = true;
			c.EnableViewState = true;


			c.ClientValidationFunction = "Father to a sister of thought";
		}