.net – Experiences using moq with VB.Net

mockingmoqunit-testingvb.net

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?

Best Solution

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.