Skip to content
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

Should more equivalence interfaces be used in Assert.Equivalent? #2697

Open
bradwilson opened this issue Mar 17, 2023 · 0 comments
Open

Should more equivalence interfaces be used in Assert.Equivalent? #2697

bradwilson opened this issue Mar 17, 2023 · 0 comments

Comments

@bradwilson
Copy link
Member

Currently, Assert.Equivalent has a check for value types to see if they implement IComparable:

https://github.com/xunit/assert.xunit/blob/d04a4dcbb7288b4cf41e60db63a43be44f8d0cb5/Sdk/AssertHelper.cs#L124-L133

This was added to ensure that non-intrinsic value type equivalence wasn't broken when we merged a change to enable reference types embedded in value types: xunit/assert.xunit@4899f6e.

This logic could use some review. At least two questions come to mind:

  1. Why does this only apply to value types and not reference types?

  2. Why does this only check for IComparable? We current look for IEquatable<T>, IComparable<T>, and IComparable as well as IStructuralEquatable, IEquatable<T2>, and IComparable<T2> (there is an open issue about ordering)

This was discovered while working through issue #2696.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant