-
Notifications
You must be signed in to change notification settings - Fork 3
What's it for
Simply put, mocking and verifying calls to Dapper data access methods with Moq.
Whilst it may not be the best approach, there are occasions where repositories need to do a bit more than simple interaction with a database.
Use case 1. Sometimes you need to affect multiple database entities based on one action, e.g. audits around a delete. And you want these to be atomic, therefore a database transaction may be involved.
Use case 2. Sometimes you need to ensure you make your database calls with correct inputs given its feature set, e.g. SQL server has a min date of 1753.
Use case 3. Sometimes you have repositories that are out of your control but you want to ensure they work correctly.
Use case 4. Sometimes the only appropriate option is to do some SQL building within the repository.
Dapper.MoqTests solves these problems with the ability to inject a MockDbConnection which can have Dapper calls Setup, Verified or both as required.