How do we mock MongoCollection<BsonDocument>

162 views
Skip to first unread message

skatuk...@gmail.com

unread,
Mar 4, 2015, 9:43:53 PM3/4/15
to mongod...@googlegroups.com
We are using MongoDB C# driver with our application. We are creating UnitTests for our API.  
We were wondering how we can mock the calls to database so that we can run Unit Tests 
without the database server running.  


Craig Wilson

unread,
Mar 5, 2015, 9:57:24 AM3/5/15
to mongod...@googlegroups.com
Most of MonngoCollection<BsonDocument> is virtual, so you can use a normal mocking framework or create your own stub. What are you having trouble with?

Also, just as a side-note, it's generally advisable to not mock something you don't own, so it might be worth your time to consider adding your own layer.
Reply all
Reply to author
Forward
0 new messages