Mocking

NMock 2 vs Moq

You may remember from my previous blog post on mocking frameworks that I'm a bit of a fan of this kind of tool. They're great for simplifying unit testing, and can also help guide you in to writing better, more loosely-coupled code via Dependency Injection.

Web Frameworks Evaluation II.iii: Mocking Database Connections in Unit Tests

One of the reasons progress on my web frameworks' evaluation has been so slow of late is that my last check-in broke my CCNET automated build, and, as the good programmer I am, I felt that this needed fixing before I made any more progress.

I'd written some unit tests for the PostController (good) that were accessing the database directly (bad), and for whatever reason the build machine couldn't successfully connect to the database. A classic case of "works on my machine!", and, as is usually the case with such things, a good example of poor design.

Subscribe to RSS - Mocking