0

After some hours creating a vb.net helper class for unit-tests and integrating moq into the project followed by a smashing hit on the "Run tests" Key-Command and then a Red Light revealed himself.

To save you the trouble of what happened. The answer that explained the problem can be found here : Experiences using moq with VB.Net

So i tough hey lets just write the test in C# ! (type mock is not an option)

After 15 min a shiny green light while the vb.net test still fails.

Would it be recommended to continue writing test in C# with a mocking framework. Or just implement for each Real-Interface a Fake-Interface in vb.net

Some constraints on the freedom are :

  • production code must be in visual basic
  • They don't know what TDD is so i shouldn't be writing test but then again thats like putting yourself ready to fall into the debug-nightmare cliff again.

Or is there an alternative approach to this?

Also my apologizes for my not so great English writing style (I am working on it) C# succeeds where vb.net fails

Community
  • 1
  • 1
David
  • 4,185
  • 2
  • 27
  • 46

1 Answers1

3

As soon as your VB.NET code is CLSCompliant you shouldn't run into any problems. But if you are using some VB.NET specific features such as Optional then it might get awkward.

r just implement for each Real-Interface a Fake-Interface in vb.net

Don't to that, it's just waste of time.

dr. evil
  • 26,944
  • 33
  • 131
  • 201
  • I have a look into CLSCompliant. – David Mar 13 '11 at 13:57
  • In what ways are optional parameters specific to VB.NET? C# 4 has them, too...!? Do the concrete implementations in C# and VB.NET actually differ at the CLI level? – stakx - no longer contributing Mar 13 '11 at 14:06
  • I don't think it is possible to write code in VB.NET that isn't CLSCompliant. Optional certainly doesn't matter, it just isn't optional to another language. – Hans Passant Mar 13 '11 at 14:48
  • @Hans, @stakx "Optional" in VB.NET is not CLSCompliant, at least for 3.5 yes code differs in IL level – dr. evil Mar 13 '11 at 15:19
  • @hans I believe it is possible to write non compliant VB. The MSDN page "writing ClsCompliant code" has a VB code sample that gives a compiler warning about non-compliance with ClsCompliant. Therefore, the compiler is saying it isn't compliant.[here](http://msdn.microsoft.com/en-us/library/bhc3fa7f.aspx) – MarkJ Mar 13 '11 at 19:10
  • @MarkJ - Ah, I forgot about the unsigned integer support. Thanks :) – Hans Passant Mar 13 '11 at 19:14