-
Notifications
You must be signed in to change notification settings - Fork 265
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
NSubstitute.Exceptions.SubstituteInternalException #784
Comments
I like to check this, but it's a lot of work to create a demo of the posted code. Could you please try to strip Dapper and provide the needed classes/interfaces? |
Hi, @Allann, @304NotModified It's not a bug. You are trying to create a mock for an extension method. That's not possible. However, I agree that the message from the exception is incorrect. There are actually two exceptions being called in this example. The first one will be ignored (most likely because the method is asynchronous). And the second exception is the one you received. If you try something like this: (await mockDbConnection.QueryFirstOrDefaultAsync<UserDetails>(Arg.Any<string>(), Arg.Any<DynamicParameters>())).Returns(expectedUserDetails); you'll get the right exception:
|
The package itself asked me to raise this issue with the following code:
To Reproduce
I had this test:
The IDbConnection is from Dapper.
the actual code being tested is:
Just running a stored proc using Dapper. This is just a unit test to ensure parameters are passed in the right order.
Expected behaviour
A clear and concise description of what you expected to happen, compared to what actually happened.
Environment:
Additional context
running in VS2022 Version 17.10.0 Preview 1.0
The text was updated successfully, but these errors were encountered: