Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you write a unit test assembly in C# to test against an assembly written in VB?

Probably a dumb question, but can you write a unit test project in one language to test against another project in a different language?

I'd like to translate one of our VB assemblies into C#, but want to build unit tests to verify the results. I've tried to set a unit test project up to do this, but I can't seem to access the VB code within a unit test... I can't figure out if I'm just missing/doing something stupid, or it really isn't allowed.

EDIT: I'm going to close this as it seems I've gotten my "Yes, it's possible" answer... I am referencing it, so there's gotta be just something I'm not seeing.

like image 634
chad Avatar asked Sep 20 '11 14:09

chad


2 Answers

Once you add a reference to your original project or assembly in your unit test project, you should be able to write a unit test without problems, assuming the members you want to test are public. (You can add an InternalsVisibleTo assembly attribute in the original assembly if you need access to classes marked internal).

like image 186
JasonTrue Avatar answered Sep 30 '22 03:09

JasonTrue


Reference the vb.net assembly or project in the test project, you'll have access to all public classes and members.

like image 25
Femaref Avatar answered Sep 30 '22 03:09

Femaref