Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@maumar may have better idea on what should be element sorter here. May be combination of Key + SomeValue could be unique and gives us stable ordering.
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.
Sure, that could also work. I'm not sure I understand when we want to assert order and when we don't care - in this test AFAICT ordering doesn't seem to be important (but no problem to add).
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.
If there is no element sorter we do contains match if expected result appear in actual results. It has slight case of incorrect result when there are duplication. So @maumar added element sorters. When element sorter is specified, both results (expected/actual) are sorted using that and then element by element match. So you want unique deterministic ordering in element sorter. We also have built-in element sorters for our entityTypes so you don't have to specify always.
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 case of anonymous types i usually order by tuple of the properties:
e => (e.Key, e.SomeValue), if that's still not deterministic then removing elementSorter is fine
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.
Looks good, the tuple makes the test pass on PG, thanks!