joaopgrassi / joaopgrassi/fluentvalidation-efcore-ruletesting

Small Update to your TestExtensions.cs

Open
#1 1 comment 1 reaction 0 assignees View on GitHub
enhancement help wanted
Dominant language
C#
Stars
10
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Hi there,

I came across your article you wrote a couple of years ago, regarding fluent validations and keeping them in sync with ef core configurations. Thanks for taking the time to share that.

I thought I would give you a heads up that there is a couple of bits needed to have the TestExtensions.cs work with the latest version of FluentValidation.

In both methods of _**GetValidatorsForMember**_ inside _**TestExtensions.cs,**_ you would just want to update the return lines (_Line 30 and 37_) with an additional **_.Select(x => x.Validator)_**

So where it's currently:

```
return descriptor.GetValidatorsForMember(expressionMemberName).ToArray();
return descriptor.GetValidatorsForMember(memberName).ToArray();
```

it would just be:

```
return descriptor.GetValidatorsForMember(expressionMemberName).Select(x => x.Validator).ToArray()
return descriptor.GetValidatorsForMember(memberName).Select(x => x.Validator).ToArray();
```

Thanks again for the article, I enjoyed it and is a nice way to check these bits are in sync with one another.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.