ValidationMethod in CustomRules Class

Topics: Developer Forum
May 11, 2007 at 4:24 PM
Hi Simon,

Just pulled down the latest source code to find ValidationMethod has been pulled from the CustomRules class:(

I've been using this to check whether specific rules have failed, where can I get that information from now?

At the moment all my unit tests are broken and I've a deadline coming up in a little under two weeks, your help would be appreciated!!!


- Andrew
May 11, 2007 at 4:32 PM
Is something like ((CustomRule)results0.Rule).Handler.Method.Name the way to go about it?

- Andrew
May 12, 2007 at 12:23 AM

The following changes have been made to CustomRule
-CustomRule.ValidationMethod removed (use CustomRule.Handler instead)
-CustomRule.ValidationTypeName removed (use CustomRule.Handler instead)
CustomValidationHandler delegate added (public delegate void CustomValidationHandler(object sender, CustomValidationEventArgs e)
-CustomRule.Handler added. returns a CustomValidationHandler

I have created a work item for this WorkItemId=10235 that explains this.

So this allows for string typing on the validation method (on both the constructor and the get of the handler).

But to the point, your code is correct. But, out of curiosity, what are you trying to achieve by getting the method name??
May 12, 2007 at 5:19 AM
Morning Simon,

Thanks for the information, will go and take a look at that work item shortly....

With regards to what I'm trying to achieve....for particular tests I want to ensure that I either have (usually!) zero or one failures of a particular (custom) rule...that make sense?

I'm open to better options:)


- Andrew
May 15, 2007 at 9:25 AM
Not really sure what you are trying to achieve. If you can give me some more detail perhaps I can help.
May 15, 2007 at 10:13 AM
Hi Simon,

All I'm trying to do is to check that a particular custom rule has failed or not.


- Andrew
May 27, 2007 at 12:36 PM
The best way to unit teat a custom rule is to call its Validate method directly.