Hi @Joe
var validator = new ApplicationValidator();
var validationResult = validator.Validate(model);
The issue relates the Validate()
method. Since you are setting the rule sets when define the validation rules, so when using the Validate()
method, you need to set the RuleSets. If not set the RuleSets, the validation result is true
.
Try to modify your code as below:
var validator = new ApplicationValidator();
var validationResult = validator.Validate(model, options => options.IncludeRuleSets("EligibilityValidator"));
You can check this screenshot:
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion