We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I want to mock both QuerySingle and Execute functions. Mocking 'Execute' after QuerySingle throws error. The error says
Message:
Stack Trace:
SqlMapper.QueryRowImpl[T](IDbConnection cnn, Row row, CommandDefinition& command, Type effectiveType) line 1180
SqlMapper.QuerySingle[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable1 commandTimeout, Nullable1 commandType) line 785
1 commandTimeout, Nullable
SqlMapper.QuerySingle(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable1 commandTimeout, Nullable1 commandType) line 691
Please see the following example: var moqConnection = new Mock(); const int expected = -44;
moqConnection.SetupDapper(c => c.QuerySingle("yyy", null, null, null, null)).Returns(-4); moqConnection.SetupDapper(c => c.Execute("zzz", null, null, null, null)).Returns(-44);
var actual1 = moqConnection.Object.QuerySingle("yyy"); var actual2 = moqConnection.Object.Execute("zzz");
In the above example, if I swap 'QuerySingle' and 'Execute' then the code works.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I want to mock both QuerySingle and Execute functions. Mocking 'Execute' after QuerySingle throws error. The error says
Message:
Stack Trace:
SqlMapper.QueryRowImpl[T](IDbConnection cnn, Row row, CommandDefinition& command, Type effectiveType) line 1180
SqlMapper.QuerySingle[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable
1 commandTimeout, Nullable
1 commandType) line 785SqlMapper.QuerySingle(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable
1 commandTimeout, Nullable
1 commandType) line 691Please see the following example:
var moqConnection = new Mock();
const int expected = -44;
moqConnection.SetupDapper(c => c.QuerySingle("yyy", null, null, null, null)).Returns(-4);
moqConnection.SetupDapper(c => c.Execute("zzz", null, null, null, null)).Returns(-44);
var actual1 = moqConnection.Object.QuerySingle("yyy");
var actual2 = moqConnection.Object.Execute("zzz");
In the above example, if I swap 'QuerySingle' and 'Execute' then the code works.
The text was updated successfully, but these errors were encountered: