Are you using NMock3? Let us know!

Coordinator
Mar 18, 2010 at 12:28 AM

Here's how I got started.

In 2007 our team was just getting started on an ASP.NET application and we were going to try to follow the Presenter First pattern.  In that pattern we saw how a mocking framework would help isolate the testing of the presenter.  We looked through the mocking frameworks at the time and saw that NMock2 was easy to understand and involved less work than other frameworks.  If something is easier to understand then developers are more likely to use it.  Over time we started using it to put unit tests around Windows Workflow Foundation State Machine activities which worked out pretty well.  The unit tests involved a little upkeep as you may know, the method/property matchers used strings so refactoring wasn't so nice.  Events were a little hard to work with out of the box.

In 2009 we reevaluated the available frameworks and liked how some had started using lambda expressions.  One problem though was that it couldn't detect when an event was bound to a delegate.  This was huge for us and our Presenters.  I then realized that if there were methods in NMock2 that took the lambda expressions, parsed out the property/method/event name and called the string based methods we would have the best of both worlds: Ease of Use and Refactoring!  NMock3 was born.

What's your story?

Sep 8, 2010 at 12:58 PM

I switched from C++ to .NET around 2005 and some time later discovered unit testing. NMock was simply the first mock object framework I stumbled across.

I've come a long way since then and when NMock 2 seemed to be abandoned, I evaluated several other frameworks. At one point, I almost switched to Moq, but I didn't like Moq's "stub by default" design (you had to explicitly "throw by default") and found its syntax less than intuitive (the interface was fluent but didn't always convey what actually happened. So I stayed with NMock 2.1, maintaining my own builds for Mono and eventually .NET 4.0.

With your updates to NMock3, I don't think I'll ever have a reason to switch again. F2 renaming was the only problem NMock2 ever had for me.