Syntax Comparison between Moq and Rhino mocks
Asked Answered
F

3

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?

Frugivorous answered 14/9, 2010 at 20:50 Comment(0)
I
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

Isotonic answered 14/9, 2010 at 22:47 Comment(4)
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.Frugivorous
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.Isotonic
+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.)Creamy
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.Porism
A
4

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

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

Alkalinity answered 14/9, 2010 at 22:27 Comment(0)
P
0

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

Panfish answered 19/9, 2010 at 6:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.