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.

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
@dtchepak dtchepak requested a review from rbeurskens May 5, 2024 12:37
@dtchepak dtchepak force-pushed the improve-output-for-expected-arg-match branch from aa3cd12 to 50401f7 Compare November 10, 2024 03:55
- 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.

Relates to nsubstitute#796.
- 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
  behaviour 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 force-pushed the improve-output-for-expected-arg-match branch from 50401f7 to 72005d0 Compare November 17, 2024 03:59
@dtchepak dtchepak requested a review from Romfos November 17, 2024 04:00
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