6

My company is trying to decide if we are going to standardize on Moq, Rhino Mocks or MS Moles and Stubs.

I know Rhino Mocks and Moles and Stubs fairly well. But I am unfamiliar with Moq. How does the syntax work? Does it support Arrange Act Assert (AAA) like Rhino Mocks (I hear they created it, but I am not sure). Does it have strong typing?

Basically, I am leaning towards Rhino Mocks (using Moles where needed). But I don't want to do that just because I am familiar with Rhino Mocks. If Moq is in fact better or (even more important) easier to use, then I want to learn it and pick that one.

So, any one out there that has used both and feels like giving me a syntax comparison?

Vaccano
  • 78,325
  • 149
  • 468
  • 850

3 Answers3

6

I've done a multi-part blog series on the differences between a number of mocking frameworks. Feel free to check it out at http://www.richard-banks.org/2010/07/mocking-comparison-part-1-basics.html

Richard Banks
  • 12,456
  • 3
  • 46
  • 62
  • Dang good stuff in those posts. Thanks for pointing me that way! Is NSubstitute "Prod" worthy? I am liking the syntax, but as a new arrival to the party, I don't know how stable it is. – Vaccano Sep 15 '10 at 17:08
  • I haven't found any real problems with it for production usage. There's a few edge cases that still need smoothing out, but that will come with time, and in those cases you can always fall back to one of the other mock frameworks. – Richard Banks Sep 17 '10 at 00:34
  • +1 for the clear write up. (Although the casual use of a finalizer in your example Tourist class raised my eyebrows - IMO you should never use a finalizer unless your class directly contains unmanaged resources.) – Wim Coenen Sep 26 '10 at 02:14
  • What Wim said (about the finalizer), but seriously, a great series of articles on mocking frameworks and new patterns of working. Just what I was looking for. Thanks. – Max Palmer Dec 16 '10 at 14:14
5

Have you looked at http://code.google.com/p/moq/wiki/QuickStart ?

Moq supports AAA and strong typing (via use of lambdas)

marcind
  • 52,944
  • 13
  • 125
  • 111
0

This project compares many mock framework against each other: mocking frameworks compare

Peli
  • 2,465
  • 16
  • 17