views:

122

answers:

3

Im new to C#/.NET . But Ive been doing TDD for quite some time now. I wanted to what is the best framework that can be used for mocking objects while writing tests in c3

A: 

You can try Rhino Mocks or NMocks

hallie
+5  A: 

Popular options

Moq and Rhino are both regular mock/stub framework. TypeMock Isolator is a bit special, as it modifies the IL to allow mocking of types you have no control over. Some like this a lot. Others feel it is too intrusive.

Brian Rasmussen
My recommendation is for Rhino Mocks - although the lambda syntax of Moq is nice, Rhino Mocks can do some things that Moq is unable to do as yet, for example, support for ref and out parameters. Haven't tried TypeMock but can imagine it being very useful when there is absolutely no way that one is able to change the code under test.
Russ Cam
Also, Moq and Rhino are free, which is not the case of Typemock...
Mathias
+1  A: 

Moles allows to replace any .NET method with a delegate. Any method including static methods or methods in sealed types.

Peli