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

Implemented Arg.Is matcher and generic constraints #733

Merged
merged 5 commits into from
Sep 3, 2023

Conversation

icalvo
Copy link
Contributor

@icalvo icalvo commented Aug 29, 2023

This PR implements a part of #634.

Arg.AnyType does not work when the type we replace has generic constraints. Therefore we converted AnyType to an interface so that the user can implement a custom class that satisfies the constraints.

Arg.Is matcher was not supported by the former PR (#715).

XML-Doc comments have been added to Arg.AnyType.

icalvo added 5 commits August 28, 2023 08:50
/// If the generic type parameter has constraints, you will have to create a derived class/struct that
/// implements those constraints.
/// </remarks>
public interface AnyType
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: what do you think about providing implementations for common constraints? In particular AnyClass (with default ctor to match : class, new()), and AnyStruct or AnyValueType.

@dtchepak dtchepak merged commit 6db536b into nsubstitute:main Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants