-
-
Notifications
You must be signed in to change notification settings - Fork 540
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
BeOneOf for object comparisons with custom comparer support #2112
Comments
In the proposed signature public AndConstraint<TAssertions> BeOneOf<TExpectation>(IEnumerable<TExpectation> validValues, IEqualityComparer<TExpectation> comparer, string because = "", params object[] becauseArgs); With the example usage you provide, re-using public AndConstraint<TAssertions> BeOneOf(IEnumerable<TSubject> validValues, IEqualityComparer<TSubject> comparer, string because = "", params object[] becauseArgs); Also only For even more consistency, we should also add this to For discoverability, this topic is related to #699. |
Mostly |
That would require a |
So what I should do next? |
Nothing. I'm waiting for @jnyrup's opinion. |
An alternative API public class ObjectAssertions : ObjectAssertions<object, ObjectAssertions>
{
public AndConstraint<ObjectAssertions> BeOneOf<TExpectation>(IEnumerable<TExpectation> validValues, IEqualityComparer<TExpectation> comparer, string because = "", params object[] becauseArgs);
}
public class ObjectAssertions<TSubject, TAssertions> : ReferenceTypeAssertions<TSubject, TAssertions>
where TAssertions : ObjectAssertions<TSubject, TAssertions>
{
public AndConstraint<TAssertions> BeOneOf(IEnumerable<TSubject> validValues, IEqualityComparer<TSubject> comparer, string because = "", params object[] becauseArgs);
} The difference comes for classes deriving from |
alternative API added |
Looks good to me. |
|
The "alternative API" together with |
ok will add test soon |
If |
If not providing an |
Background and motivation
Support for custom comparer to compare objects
API Proposal
API Usage
Alternative Designs
No response
Risks
No response
The text was updated successfully, but these errors were encountered: