views:

485

answers:

2

I really like the moq mocking framework. I've used it on several projects. Unfortunately, one of my customers is demanding we use VB.Net. Not my preference, but hey, .Net is .Net, right?

I've heard that moq has some trouble with VB. Is this true? Is so, what sorts of trouble? I would expect it to work fine given the language agnostic nature of .Net.

Should I look into using some other mocking framework for use with VB?

+3  A: 

The main problem of VB.net with regards to mocking frameworks is that, contrary to C#, VB does not have anonymous methods, only Lambda expressions (no way to declare an anonymous Action delegate).

This severely limits the possibilities. There is also a known issue with properties with parameters.

Also, the syntax of the language for lambdas does not lead to something as clean as C#, readability-wise (no flames please, I'm a VB user and I miss some C# features every day), and that's partly the attraction for Moq.

The only testing framework I know of that did something with regards to VB is TypeMock. They tried to design something that blends with the VB syntax.

Denis Troller
What sort of issue is there with parameterized properties?
Craig Quillen
I am refering to issue 61: http://code.google.com/p/moq/issues/detail?id=61I don't know if it has been taken care of since it was raised.
Denis Troller
+1  A: 

AFAIK Typemock Isolator is the only tool that can fully mock VB.NET. They made an API especially for that.

yep. example is here:http://site.typemock.com/vbpage/2009/9/10/unit-testing-vbnet.html
RoyOsherove