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 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(); }