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

How to tell if a method/property has been substituted/configured? #827

Open
Metritutus opened this issue Aug 30, 2024 · 0 comments
Open

Comments

@Metritutus
Copy link

Question
If you create a Substitute for a type via Substitute.For<MyType>(), you can detect if the instance is a substitute by checking if myInstance is ICallRouterProvider (as per #659).

However, what I have been unable to figure out is how to tell whether a method/property has been configured (ie via Returns(), Do(), etc). With Moq you could do this via searching the Setups collection, but there does not seem to be any equivalent here.

If there's no public API available to access this information, I don't mind having to utilise reflection to achieve this, however I'm not very familiar with NSubstitute, and my initial investigative efforts have only led me so far (ie that I may potentially be looking to try and access CallActions from somewhere, however I could be mistaken).

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

No branches or pull requests

1 participant