views:

69

answers:

2

Most of the sexy new .Net mock frameworks have heavy dependencies on 3.5 language features such as lambdas and extension methods. I'm looking for recommendations for the "best" mocking tool for a legacy-ish project developed in .Net 2.0.

The criteria for "best" would be ease-of-use and readability first, followed by power and scope of features.

My research so far has found:

  • PEX/MOLE: MS Research - 3.5 and above, disqualified
  • Moq: 3.5 and above, disqualified
  • Rhino: Supports 2.0 via Record/Playback pattern (so far this seems the best option?)
  • NMock, Nunit.Mock: Use strings for type/method names - ugly...
  • TypeMock: older versions supported 2.0, but current version doesn't ?

Any other recommendations?

+2  A: 

Just because the project is developed in .NET 2.0 doesn't strictly mean your tests have to be. For a project here where the requirement was the project target .NET 2.0 (due to being plugged into a larger legacy framework that only worked with .NET 2.0), we used VS 2008, made the actual 'real' project target 2.0, but our test project targeted 3.5, and we could use all the associated goodies (Rhino.Mocks using the AAA pattern, LINQ, etc).

Just a thought, if that's an option for you. If not, I would say Rhino.Mocks via Record/Playback, which is what we used when we were using VS 2005 and had no other option.

Pete