If a ValidationSummary has DisplayMode="List" or
DisplayMode="SingleParagraph" and you clear its
Forecolor, NunitASP generates a
NullReferenceException when you try to access the
ValidationSummaryTester's "messages" property.
This does not occur if the DisplayMode is BulletList,
which is the default. It also does not occur if a
Forecolor is selected.
To reproduce the error:
On the aspx web form named test.aspx:
<asp:textbox id="TextBox1"
runat="server"></asp:textbox>
<asp:requiredfieldvalidator
id="RequiredFieldValidator1" runat="server"
ErrorMessage="box is required"
ControlToValidate="TextBox1">*</asp:requiredfieldvalid
ator><BR>
<asp:button id="Button1" runat="server"
Text="Button"></asp:button><BR>
<asp:validationsummary id="ValidationSummary1"
runat="server" ForeColor=" "
DisplayMode="List"></asp:validationsummary>
In the NunitASP test page:
Dim Box As TextBoxTester
Dim btn As ButtonTester
Dim Val As ValidationSummaryTester
Browser.GetPage("http://localhost/test.aspx")
Box = New TextBoxTester("TextBox1", CurrentWebForm)
btn = New ButtonTester("Button1", currentwebform)
Val = New ValidationSummaryTester
("ValidationSummary1", currentwebform)
btn.Click()
Console.WriteLine("first message in validation
summary is :" & Val.Messages(0))