mongodb/mongo-csharp-driver — pull request #119 by myles-mcdonnell (2012-06-28 15:00:23+00:00)
Title: Additional Interfaces to enable mocking (and thus unit testing) of mongodb client apps.

Hello

I have created 6 new interfaces..

- IMongoServer
- IMongoDatabase
- IMongoCollection
- IMongoCollectionT
- IMongoCursor
- IMongoCursorT

..to enable mocking and thus unit testing of MongoDB client apps. There is much more of the API that IMHO could benefit from interfaces for this purpose but this was enough for my current requirement.

I previously achieved the same thing with a separate lib (https://github.com/myles-mcdonnell/DCouple.Mongo) which includes a client demo app. but I think it's better to enhance the driver rather than manage a separate lib.

I also removed the explicit interface definition of GetEnumerator() on MongoCursor as I don't think it is required. In this case defining the generic GetEnumerator on the concrete MongoCursor as new is ok as IEnumerable implements IEnumerable so it doesn't break polymorphism.

I hope you like the changes!

Kind Regards
Myles