Is it possible to use ValidationTestExtension to test a validator with a ruleset?

Jul 17, 2014 at 1:56 PM
Hi :)

I can't figure out how to use the ValidationTestExtension's to test a validator but against a ruleset.

for example, given this code .. how can I include a ruleset in this test?
public void GivenAnUnknownCategoryType_Validate_ShouldHaveAValidationError()
     // RuleSet to test is called 'Minimum'
    _validator.ShouldHaveValidationErrorFor(listing => listing.CategoryType, CategoryType.Unknown);
Jul 18, 2014 at 7:17 AM
The test extensions don't support rulesets. You'll need to invoke the validator manually and perform assertions on the ValidationResult.

Jul 18, 2014 at 12:15 PM
Thanks heaps Jeremy for the reply. I was thinking you might say that.

Would you accept a PR if I tweak the extension method(s) to have an optional ruleSet string?
Jul 18, 2014 at 12:28 PM
If you'd like to submit a pull request, that would be great, thanks.
Jul 18, 2014 at 12:48 PM
Jul 21, 2014 at 12:49 PM
Thanks - I've merged it in. In future, it'd be great if you could match your commits with the existing code style (tabs instead of spaces etc). Thanks!
Jul 23, 2014 at 12:44 AM
Hi Jeremy,

thanks heaps for accepting it. Ah! i didn't notice the tabs/spaces thing, but apologies for that.

Will there be a new Nuget package coming out with this PR?
Sep 9, 2014 at 1:58 AM
Hi Jeremy,

polite bump re: a new nuget pacakge coming out with this change?
Sep 10, 2014 at 8:19 AM

I've been away on business for all of August, and then was on holiday for 2 weeks, so I haven't had an opportunity to do any open source development. I'll look at trying to get back into things this month, but can't say when that will be. For now please build from source.