Here is the information about my development environment:
MongoDB 3.0.0
MongoDB C# Driver Version 1.7.0.4714
Microsoft Visual Studio Professional 2013
.NET Framework 4.0
We are about to do our first production release. We developed the application using the Domain-Driven Design approach. Unfortunately, we did Not write any unit test cases.
We haven't really adhered to proper coding practices that would allow for flexibility int the future. For example, in the following code we have Not used an Interface for the Database connectivity, but we have just directly instantiated the Database connectivity class:
public class BLLCs_BookStore_Catalog : ICs_BookStore_Catalog
{
public IEnumerable<ELLCsBook> GetAParticularBook(ObjectId BookIdArg)
{
IMongoQuery qry = Query<ELLCsBook>.EQ(l => l.Id, BookIdArg);
return DBConnection.database.GetCollection<ELLCsBook>(TableNameConstants.BooksTableName)
.Find(qry);
}
}
Sadly , there is a tonne of code that look like the aforementioned code.
The problem is that it would take an Enormous amount of effort, time and money to just refactor existing code to use an Interfaces. Therefore, integrating unit testing would be a real pain.
Does anyone have any suggestions as to how we could still do Unit testing?
I would highly suggest you to use Typemock Isolator. It allows to deal not only with interfaces, so no need to spend money and time for the refactoring.
Furthermore, it can make unit-test suggestions based on your code, so it also can save some time.
There is a good answer/example of how you can mock calls to mongo database using Typemock here.
Hope it helps!