Quantcast
Channel: Fluent Validation for .NET
Viewing all articles
Browse latest Browse all 1917

Edited Unassigned: ShouldHaveValidationErrorFor not working for collection where a RuleForEach is specified [7201]

$
0
0
Imaging the following rule:

```
RuleForEach(command => command.Recipients)
.Length(9, 15)
WithMessage(Resources.ValidationMessages.SmsMessageRecipientInvalidLength);
```

The Recipients property is defined as ICollection<string>.

When the recipients collection contains strings with a length less than 9 or greater than 15 then a call to ShouldHaveValidationErrorFor results in an exception within the unit test (ValidationTestException: Expected a validation error for property Recipients).



Viewing all articles
Browse latest Browse all 1917

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>