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

Add ability to capture and verify on an argument at the same time #781

Open
asos-AdamCox opened this issue Feb 16, 2024 · 1 comment
Open
Assignees
Labels
feature-request Request for a new NSubstitute feature

Comments

@asos-AdamCox
Copy link

Is your feature request related to a problem? Please describe.
I've found in the past that when a mocked interface takes a large object it can make the verification of a call very large. This can mean the code isn't very readable and the failure message isn't able to distinguish exactly which field didn't match in the call vs. the verification.

Describe the solution you'd like
The best approach I've found is to split up the verification into a simple verification which just uniquely identifies a call and captures the complex object(s) and then subsequent assertions against the fields in those complex objects.

Describe alternatives you've considered
Can't really think of alternatives. The way I'm looking to solve it is already implemented in Moq.

Additional context
I've raised a PR that would allow the above (#780) this is my first NSubstitute PR and actually my first OSS PR so I'm more than happy to make changes if you folks feel there's a better way of doing it.

@asos-AdamCox
Copy link
Author

asos-AdamCox commented Feb 27, 2024

I'd really like to progress with this issue and hopefully the fairly simple PR (linked to above) is sufficient - is anyone available to review/approve? It has occurred to me that instead of adding a new Arg.Do overload another way of tackling it would be to make the relevent ArgumentMatcher.Enqueue method public and consumer code can then call that rather than via Arg?
@Romfos, @brad, @alexandrnikitin sorry to call you folks out but you're the last 3 committers and I'm hoping one of you may be able to find some time to review this PR?

@304NotModified 304NotModified added the feature-request Request for a new NSubstitute feature label Apr 29, 2024
@dtchepak dtchepak self-assigned this May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for a new NSubstitute feature
Projects
None yet
Development

No branches or pull requests

3 participants