public void ValidationSummary_Defaults()
        {
            ValidationSummaryTestClass v = new ValidationSummaryTestClass();

            Assert.AreEqual(ValidationSummaryDisplayMode.BulletList, v.DisplayMode, "D1");
            Assert.AreEqual(true, v.EnableClientScript, "D2");
            Assert.AreEqual(Color.Red, v.ForeColor, "D3");
            Assert.AreEqual(string.Empty, v.HeaderText, "D4");
            Assert.AreEqual(true, v.ShowSummary, "D5");
        }
        public void SupportsDisabledAttribute()
        {
            var ver40 = new Version(4, 0);
            var ver35 = new Version(3, 5);
            var p     = new ValidationSummaryTestClass();

            Assert.AreEqual(ver40, p.RenderingCompatibility, "#A1-1");
            Assert.IsFalse(p.SupportsDisabledAttribute, "#A1-2");

            p.RenderingCompatibility = new Version(3, 5);
            Assert.AreEqual(ver35, p.RenderingCompatibility, "#A2-1");
            Assert.IsTrue(p.SupportsDisabledAttribute, "#A2-2");
        }
        public void ValidationSummary_ValidationGroup()
        {
            ValidationSummaryTestClass v = new ValidationSummaryTestClass();

            v.SetTrackingVS();
            Assert.AreEqual("", v.ValidationGroup, "VG1");

            v.ValidationGroup = "group";
            Assert.AreEqual("group", v.ValidationGroup, "VG2");

            /* make sure ValidationGroup is stored in the view state */
            object state = v.Save();

            ValidationSummaryTestClass v2 = new ValidationSummaryTestClass();

            v2.SetTrackingVS();
            v2.Load(state);

            Assert.AreEqual("group", v2.ValidationGroup, "VG3");
        }
        public void ValidationSummaryRenderTest()
        {
            ValidationSummaryTestClass v;

            RangeValidatorTest.RangeValidatorTestClass p;
            RangeValidatorTest.RangeValidatorTestClass p2;
            TextBox t1;
            TextBox t2;

            v = new ValidationSummaryTestClass();
            p = new RangeValidatorTest.RangeValidatorTestClass();

            v.HeaderText = "I am the header text";

            StartValidationTest(p);
            p.SetTrackingVS();
            p.Type            = ValidationDataType.Integer;
            p.MinimumValue    = "2";
            p.MaximumValue    = "4";
            p.ErrorMessage    = "aw shucks";
            p.Enabled         = true;
            p.EnableViewState = true;
            p.CallInit();
            p.ID = "moep";

            t1 = SetValidationTextBox("textbox", "1");
            Assert.AreEqual(false, p.DoEvaluateIsValid(), "R1");

            p2 = new RangeValidatorTest.RangeValidatorTestClass();
            Page.Controls.Add(p2);
            p2.SetTrackingVS();
            p2.Type            = ValidationDataType.Integer;
            p2.MinimumValue    = "6";
            p2.MaximumValue    = "7";
            p2.ErrorMessage    = "WhamBamThankYouMam";
            p2.Enabled         = true;
            p2.EnableViewState = true;
            p2.CallInit();
            p2.ID = "moep2";

            t2 = this.AddTextBox("textbox2", "2");
            p2.ControlToValidate = "textbox2";

            p.Validate();
            p2.Validate();

            Page.Controls.Add(v);

            // Default DisplayMode
            Assert.AreEqual("<div style=\"color:Red;\">\n\tI am the header text<ul><li>aw shucks</li><li>WhamBamThankYouMam</li></ul>\n</div>", v.Render(), "R2");

            v.DisplayMode = ValidationSummaryDisplayMode.BulletList;
            Assert.AreEqual("<div style=\"color:Red;\">\n\tI am the header text<ul><li>aw shucks</li><li>WhamBamThankYouMam</li></ul>\n</div>", v.Render(), "R3");

            v.DisplayMode = ValidationSummaryDisplayMode.List;
#if NET_2_0
            Assert.AreEqual("<div style=\"color:Red;\">\n\tI am the header text<br />aw shucks<br />WhamBamThankYouMam<br />\n</div>", v.Render(), "R4");
#else
            Assert.AreEqual("<div style=\"color:Red;\">\n\tI am the header text<br>aw shucks<br>WhamBamThankYouMam<br>\n</div>", v.Render(), "R4");
#endif

            v.DisplayMode = ValidationSummaryDisplayMode.SingleParagraph;
#if NET_2_0
            Assert.AreEqual("<div style=\"color:Red;\">\n\tI am the header text aw shucks WhamBamThankYouMam <br />\n</div>", v.Render(), "R5");
#else
            Assert.AreEqual("<div style=\"color:Red;\">\n\tI am the header text aw shucks WhamBamThankYouMam <br>\n</div>", v.Render(), "R5");
#endif

            v.ShowSummary = false;
            v.DisplayMode = ValidationSummaryDisplayMode.BulletList;
            Assert.AreEqual("", v.Render(), "R6");

            v.ShowSummary        = true;
            v.EnableClientScript = true;
            v.ShowMessageBox     = true;
            v.DisplayMode        = ValidationSummaryDisplayMode.SingleParagraph;
#if NET_2_0
            Assert.AreEqual("<div style=\"color:Red;\">\n\tI am the header text aw shucks WhamBamThankYouMam <br />\n</div>", v.Render(), "R7");
#else
            Assert.AreEqual("<div style=\"color:Red;\">\n\tI am the header text aw shucks WhamBamThankYouMam <br>\n</div>", v.Render(), "R7");
#endif

            StopValidationTest();
        }
		public void SupportsDisabledAttribute ()
		{
			var ver40 = new Version (4, 0);
			var ver35 = new Version (3, 5);
			var p = new ValidationSummaryTestClass ();
			Assert.AreEqual (ver40, p.RenderingCompatibility, "#A1-1");
			Assert.IsFalse (p.SupportsDisabledAttribute, "#A1-2");

			p.RenderingCompatibility = new Version (3, 5);
			Assert.AreEqual (ver35, p.RenderingCompatibility, "#A2-1");
			Assert.IsTrue (p.SupportsDisabledAttribute, "#A2-2");
		}
		public void ValidationSummaryRenderTest () {
			ValidationSummaryTestClass	v;
			RangeValidatorTest.RangeValidatorTestClass		p;
			RangeValidatorTest.RangeValidatorTestClass		p2;
			TextBox				t1;
			TextBox				t2;

			v = new ValidationSummaryTestClass ();
			p = new RangeValidatorTest.RangeValidatorTestClass();

			v.HeaderText = "I am the header text";

			StartValidationTest(p);
			p.SetTrackingVS();
			p.Type = ValidationDataType.Integer;
			p.MinimumValue = "2";
			p.MaximumValue = "4";
			p.ErrorMessage = "aw shucks";
			p.Enabled = true;
			p.EnableViewState = true;
			p.CallInit();
			p.ID = "moep";

			t1 = SetValidationTextBox("textbox", "1");
			Assert.AreEqual(false, p.DoEvaluateIsValid(), "R1");

			p2 = new RangeValidatorTest.RangeValidatorTestClass();
			Page.Controls.Add(p2);
			p2.SetTrackingVS();
			p2.Type = ValidationDataType.Integer;
			p2.MinimumValue = "6";
			p2.MaximumValue = "7";
			p2.ErrorMessage = "WhamBamThankYouMam";
			p2.Enabled = true;
			p2.EnableViewState = true;
			p2.CallInit();
			p2.ID = "moep2";

			t2 = this.AddTextBox("textbox2", "2");
			p2.ControlToValidate = "textbox2";

			p.Validate();
			p2.Validate();

			Page.Controls.Add(v);

			// Default DisplayMode
			Assert.AreEqual("<div style=\"color:Red;\">\n\tI am the header text<ul><li>aw shucks</li><li>WhamBamThankYouMam</li></ul>\n</div>", v.Render(), "R2");

			v.DisplayMode = ValidationSummaryDisplayMode.BulletList;
			Assert.AreEqual("<div style=\"color:Red;\">\n\tI am the header text<ul><li>aw shucks</li><li>WhamBamThankYouMam</li></ul>\n</div>", v.Render(), "R3");

			v.DisplayMode = ValidationSummaryDisplayMode.List;
			Assert.AreEqual("<div style=\"color:Red;\">\n\tI am the header text<br />aw shucks<br />WhamBamThankYouMam<br />\n</div>", v.Render(), "R4");

			v.DisplayMode = ValidationSummaryDisplayMode.SingleParagraph;
			Assert.AreEqual("<div style=\"color:Red;\">\n\tI am the header text aw shucks WhamBamThankYouMam <br />\n</div>", v.Render(), "R5");

			v.ShowSummary = false;
			v.DisplayMode = ValidationSummaryDisplayMode.BulletList;
			Assert.AreEqual("", v.Render(), "R6");

			v.ShowSummary = true;
			v.EnableClientScript = true;
			v.ShowMessageBox = true;
			v.DisplayMode = ValidationSummaryDisplayMode.SingleParagraph;
			Assert.AreEqual("<div style=\"color:Red;\">\n\tI am the header text aw shucks WhamBamThankYouMam <br />\n</div>", v.Render(), "R7");

			StopValidationTest();
		}
		public void ValidationSummary_ValidationGroup () {
			ValidationSummaryTestClass v = new ValidationSummaryTestClass ();
			v.SetTrackingVS();
			Assert.AreEqual ("", v.ValidationGroup, "VG1");

			v.ValidationGroup = "group";
			Assert.AreEqual ("group", v.ValidationGroup, "VG2");

			/* make sure ValidationGroup is stored in the view state */
			object state = v.Save ();

			ValidationSummaryTestClass v2 = new ValidationSummaryTestClass ();
			v2.SetTrackingVS();
			v2.Load (state);

			Assert.AreEqual ("group", v2.ValidationGroup, "VG3");
		}
		public void ValidationSummary_Defaults () {
			ValidationSummaryTestClass v = new ValidationSummaryTestClass ();

			Assert.AreEqual (ValidationSummaryDisplayMode.BulletList, v.DisplayMode, "D1");
			Assert.AreEqual (true, v.EnableClientScript, "D2");
			Assert.AreEqual (Color.Red, v.ForeColor, "D3");
			Assert.AreEqual (string.Empty, v.HeaderText, "D4");
			Assert.AreEqual (true, v.ShowSummary, "D5");
		}