Comments (3)
I figured out the issue. I was using "IDbConnection" instead of "DbConnection". Perhaps the source should be updated to not throw exceptions on IDbConnection.
from moq.dapper.
Hi @davemcmanus, the IDbConnection
interface exposes IDbCommand
which itself has no async methods at all (see https://docs.microsoft.com/en-us/dotnet/api/system.data.idbcommand?view=netframework-4.7.2 and https://docs.microsoft.com/en-us/dotnet/api/system.data.common.dbcommand?view=netframework-4.7.2).
The async versions are only present on the DbCommand
class exposed by the DbConnection
. Even when you use IDbConnection
Dapper internally downcast it to a DbConnection therefore it would give you an exception anyway on that side.
from moq.dapper.
Hi @davemcmanus, the
IDbConnection
interface exposesIDbCommand
which itself has no async methods at all (see https://docs.microsoft.com/en-us/dotnet/api/system.data.idbcommand?view=netframework-4.7.2 and https://docs.microsoft.com/en-us/dotnet/api/system.data.common.dbcommand?view=netframework-4.7.2).The async versions are only present on the
DbCommand
class exposed by theDbConnection
. Even when you useIDbConnection
Dapper internally downcast it to a DbConnection therefore it would give you an exception anyway on that side.
@UnoSD Thanks for your reply. Makes sense.
from moq.dapper.
Related Issues (20)
- moq.dapper 1.0.4 is a breaking change (only targets .Net Standard 2.1)
- When writing a test for query which has .Any method it throws an error Value cannot be null
- issue with DateTime in Core3.1 (works on 2.1)
- QuerySingleOrDefault cannot return null HOT 1
- QueryFirstAsync<string> doesn't work and throws sequence contains no elements error HOT 2
- Cannot moq 'Execute' after mocking 'QuerySingle<int>'
- How to Moq QueryMultipleAsync HOT 2
- ObjectExtensions - ToDataTable does not support string HOT 1
- QueryAsync<Dynamic> HOT 4
- Cannot mock ExecuteAsync for IDbConnection HOT 1
- Cannot QueryFirstAsync with Enum Type
- Can't query Tuples. Requires wrapping class type.
- One Approach to Moq dapper methods that not supported by this project
- No Support for ExecuteAsync on IDBConnection
- ExecuteScalarAsync not supported
- GPL2 licence issues HOT 3
- QueryAsync returns no records
- Moq with ReturnAsync for GUID is not working
- Testing Query with string array parameter
- Requesting support for Verify functions too
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moq.dapper.