Closed jmlaurenti closed 3 days ago
Hi
Thanks for opening this issue, but HasFieldsWithSameValues
works as designed, here, for better or for worse.
I am not sure what you are trying to test for here, but you should expect to get the good result simply by using Check.That(a).IsEqualTo(b)
.
If you still need fine control about the test, you can look into Considering
.
You can see #119 for context and history regarding HasFieldsWithSameValues
.
We will not change the behavior of an old check as it will introduce a breaking change. So I close this issue.
Feel free to open a new one or reopen this one if you are still unable to get the desired behavior via previous suggestions.
Hi @dupdob ,
thanks a lot for your prompt reply.
I'm validating a serialize/deserialize process, and want to compare the source List
I was surprised to see that the way items are added to the list is influencing the NFluent test result, just because of the _version field which is used to prevent list modification while enumerating (if I understand correctly).
Anyway, I do understand now the history of that feature, and agree that changing its behavior is a bad idea. I'll find a way !
Have a great day, JM
Bug Type Please pick one:
Describe the bug Comparing 2 collections (List) containing objects with same values is raising an error because the collection non-public member "_version" (which is incremented when adding/removing items) is different between the 2 collections it similar items are not added exactly in the same manner
To Reproduce
Expected behavior Non Public members should not be considered when comparing field values.
Screenshots
Desktop (please complete the following information):
Additional context Add any other context about the problem here.