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

Improve output for expected argument matchers #806

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dtchepak
Copy link
Member

@dtchepak dtchepak commented May 5, 2024

  • Add IDescribeSpecification to allow custom arg matchers to provide custom output for "expected to receive" entries.
  • Fallback to ToString when IDescribeSpecification not implemented.
  • Update code comment docs accordingly.

Closes #796.

- Add IDescribeSpecification to allow custom arg matchers to provide
  custom output for "expected to receive" entries.
- Fallback to ToString when IDescribeSpecification not implemented.
- Update code comment docs accordingly.

Closes nsubstitute#796.
@dtchepak dtchepak force-pushed the improve-output-for-expected-arg-match branch from 957259f to e4bdaed Compare May 5, 2024 06:07
src/NSubstitute/Core/CallSpecification.cs Outdated Show resolved Hide resolved
src/NSubstitute/Core/CallSpecification.cs Outdated Show resolved Hide resolved
src/NSubstitute/Core/Arguments/ArgumentMatcher.cs Outdated Show resolved Hide resolved
src/NSubstitute/Core/Arguments/ArgumentMatcher.cs Outdated Show resolved Hide resolved
- use string.Empty for null value from IDescribeSpecification, rather than
  falling back to ToString(). This supports the contract that
  IDescribeSpecification will be used if implemented. Replacing
  null string.Empty with matches the documented
  bheaviour of IDescribeNonMatches.
- updated IDescribeSpecification code docs.
- removed GenericToNonGenericMatcherProxyWithDescribe `ToString` as it
  can use the GenericToNonGenericMatcherProxy superclass implementation.
- update ArgumentSpecification to also support IDescribeSpecification
  for its matcher.
- Replace linq with Array.ConvertAll rather than requiring an extra
  ToArray conversion.
@dtchepak dtchepak requested a review from rbeurskens May 5, 2024 12:37
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.

Improve output for expected argument for custom argument matchers on non-match or make it customizable
2 participants