-
Type:
Improvement
-
Resolution: Done
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Feature Request
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Adding virtual to the overloads of Insert, Update, and Save in MongoCollection will make unit testing much easier. I pulled the source and made the change for Insert and it does work as expected.
Example usage in unit test (using RhinoMocks):
public class DatabaseFactory
{
public static MongoDatabase Create()
}
This allows defensively checking boundary conditions in repositories, and if they all pass the database isn't actually called. The server process can actually be turned off and all unit tests can be run, and then turned on for integration tests.
Maybe a mocking super genius has a better way, but this is the best I could come up with after a while of fiddling around.