Open waznico opened 1 year ago
Hi @waznico,
I'm not familiar with GRPC but tried with a naive implementation based on the code you shared and was unable to reproduce this. A few things to try:
myGrpcClient.MyFunctionAsync(...).ReturnsForAnyArgs(...)
with myGrpcClient.Configure().MyFunctionAsync(...).ReturnsForAnyArgs(...)
(will need to add import for NSubstitute.Extensions
). The use of Configure()
will prevent any real code from being executed in the substituted class that could be consuming arg matchers.If neither of those work would you be able to share a minimal repro I can run?
Here is the code I used for testing:
Hi @dtchepak,
thanks for your reply. I'll try it out by the end of the week when I'm back on the topic.
Is this the same as https://github.com/nsubstitute/NSubstitute/issues/725?
Describe the bug I'm trying to mock my GRPC calls as I did before in Moq. But NSubstitute is throwing an exception. I used the following code to mock it:
The exception I receive looks like this:
The method has another overload without CallOptions. If I mock this NSubstitute won't throw an exception, but my application will not call the mock.
Here's the code generated by the GRPC plugin:
Mocking of the method that contains fewer arguments that also differs from the method with more paremeters doesn't seem to be accepted by NSubstitute.
To Reproduce
Expected behaviour It should be possible to mock MyFunctionsAsync that contains fewer and different parameters.
Environment: