I am working in a web forms project and I’m constrained to use validation controls such as compare validator like:
<asp:CompareValidator ID="SomeValidator" ValueToCompare="Some
Value" ControlToValidate="MyControl" ErrorMessage="Some Error
Message." Operator="NotEqual" runat="server"></asp:CompareValidator>
I would rather split validation rules out but I can’t in this case.
I would at least like to test that the properties on the validator control are correct.
For example, I would like test like:
SomeValidator_Has_A_ControlToValdiate_MyControl or
SomeValidator_Has_Value_To_Compare_SomeValue etc
Can this be done using reflection and can someone show me a sample please?
Or is there any better way?
The answer appears top be that without using MVP etc, web forms simply can’t be tested in the way I would like.