views:

920

answers:

4

What's the best mocking framework syntax-wise and capability-wise ?

My problem: Most mocking frameworks use lambda expressions now, which are really ugly to write in VB.NET, so is there any framework that has nice syntax without lambdas or has fluent syntax that doesn't need lambdas?

A: 

rhino mocks.

But you could have trouble with the new lambda-expression syntax (especially when setting expectations on subs) so either use the new syntax or be prepared to work around it.

chrissie1
I suppose it's too late to ask the downvoter of this answer to explain why. Is there something wrong with Rhino Mocks, or with this answer's explanation of the issues it presents?
MatrixFrog
+2  A: 

I think capability wise Typemock is the best framework for .Net, instead of working within the runtime it hooks into the CLR and can intercept about any call. This enables you to mock and test anything you want. Some people think it's too powerful. It allows you to test anything while usually the fact that you can't test something is a good warning that there's something wrong with your design. Also it's not free.

I mainly use Rhino Mocks. It has a really readable syntax, especially the new AAA syntax. Moq is quite new and should be good too, syntax wise. Although I haven't tested it yet.

Mendelt
A: 

Typemock's VB APIs are very simple to use, and it has all kinds of functionality like faking Shared functions.

A: 

FYI, Isolator has VB.NET specific API so you should be able to use it easily: http://www.typemock.com/vbpage.php

However, it is a commercial product.

RoyOsherove