It should work like that, although since FA 2.0 that API is not the recommended way of doing this (although that old API is using the new API under the hood). I need to see if any of the unit tests is covering this particular scenario.
FluentAssertions: comparing shared properties of list members
-
31-05-2022 - |
Question
I have to compare two collections taking into account only the shared properties. If I understand Dennis' comment on How to combine collection and property assertions using fluent-assertions? this should work as of version 2.0.
I am using this API:
ActualOes.ShouldHave().SharedProperties().EqualTo(expectedOes);
ActualOes is of type IEnumerable<IOe>
and expectedOes is IEnumerable<Object>
where the elements are objects of an anonymous type sharing just a few properties with the actual IOe
interface.
When I run this, FA complains about the missing properties.
Am I using the wrong API?
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow