-
Notifications
You must be signed in to change notification settings - Fork 731
Allow anonymous object for selecting fields/properties at Exclude and Include
#2488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow anonymous object for selecting fields/properties at Exclude and Include
#2488
Conversation
Pull Request Test Coverage Report for Build 7036088817
💛 - Coveralls |
552be02 to
c1e2441
Compare
Qodana for .NETIt seems all right 👌 No new problems were found according to the checks applied 💡 Qodana analysis was run in the pull request mode: only the changed files were checked View the detailed Qodana reportTo be able to view the detailed Qodana report, you can either:
To get - name: 'Qodana Scan'
uses: JetBrains/qodana-action@v2023.2.8
with:
upload-result: trueContact Qodana teamContact us at qodana-support@jetbrains.com
|
e869e49 to
1a87f18
Compare
Exclude and Include
1a87f18 to
1ac4b66
Compare
|
Hmm.. discovered a bad bug... Will fix it in the evening 🫣 |
1ac4b66 to
85cba3f
Compare
Qodana for .NETIt seems all right 👌 No new problems were found according to the checks applied 💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at qodana-support@jetbrains.com
|
8191b33 to
b363b4b
Compare
Pull Request Test Coverage Report for Build 11767671047Details
💛 - Coveralls |
b363b4b to
ba177ab
Compare
6aa70b4 to
fb28d7f
Compare
dennisdoomen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻 Very nice feature
🔧 We only use var if the type is obvious.
| segments.Add($"[{argumentExpression.Value}]"); | ||
| singlePath = $"[{argumentExpression.Value}].{singlePath}"; | ||
| break; | ||
| case ExpressionType.New: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
♻️ This entire method is become too bloated and needs some refactoring (but maybe not now). An implementation of the Strategy Pattern might be a better fit.
|
|
||
| IEnumerable<string> reversedSegments = segments.AsEnumerable().Reverse(); | ||
| string segmentPath = string.Join(".", reversedSegments); | ||
| if (singlePath is null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ What happens if singlePath is non-null and selectors isn't empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I can see, this cannot happen, because you either have: .Excluding(p => p.NestedField)(which results in singlePath to be non-null and segments to be empty) or .Excluding(p => new { p.NestedField } ) (which results in singlePath null + segments not empty).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My point was that the code doesn't make that clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I add a comment for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, we have do do it exactly like this, because in case of .Excluding(p => new { }) singlePath stays null and the segments stays empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, I would make it an if, else if and else. Even though the huge switch is difficult to process, you at least can see what will happen at the end.
Tests/FluentAssertions.Equivalency.Specs/SelectionRulesSpecs.Excluding.cs
Outdated
Show resolved
Hide resolved
d3d766f to
fe0e37c
Compare
|
I think I've addressed all the blocking changes. |
This refers to `Excluding` / `For.Exclude` and `Including`
Co-authored-by: Dennis Doomen <dennis.doomen@avivasolutions.nl>
Co-authored-by: Dennis Doomen <dennis.doomen@avivasolutions.nl>
fe0e37c to
b0c2ff7
Compare
This refers to
Excluding()/.For().Exclude()andIncluding().This closes #2479
IMPORTANT
./build.sh --target spellcheckor.\build.ps1 --target spellcheckbefore pushing and check the good outcome