-
Notifications
You must be signed in to change notification settings - Fork 3
What's supported
Setup of any Dapper method, listed below. Verification of any Dapper method, listed below. No need to setup a Dapper call (no data will be returned from the call, but it will be executed) All the power, and familiar syntax of Moq.
-
Execute
&ExecuteAsync
-
Query<T>
&QueryAsync<T>
-
QuerySingle<T>
&QuerySingleAsync<T>
-
QuerySingleOrDefault<T>
&QuerySingleOrDefaultAsync<T>
-
QueryFirst<T>
&QueryFirstAsync<T>
-
QueryFirstOrDefault<T>
&QueryFirstOrDefaultAsync<T>
-
ExecuteScalar
,ExecuteScalar<T>
,ExecuteScalarAsync
andExecuteScalarAsync<T>
- SQL (case insensitive, ignores empty lines & leading/trailing white-space)
- Parameters
- Transaction
- CommandType
- CommandTimeout
E.g.
conn.Query<Car>("select * from vehicles where id = @id", new { id = 1});
conn.Query<Truck>("select * from vehicles where id = @id", new { id = 1});
Set Settings.Default.ResetDapperCachePerCommand
to true
to solve this. Note this is not thread safe, there is no other known solution to this circumstance at present. This setting can be defined statically via Settings.Default
or supplied via an instance of the Settings
provided to the MockDbConnection
The following arguments cannot currently be reverse engineered therefore cannot be accurately asserted:
buffered
map
types
splitOn
Issues exist to resolve these where possible, but currently there is no solution except to not expect/verify these values, i.e use It.IsAny<>()
for now.