How do you unit test an assembly if the vast majority of its methods are declared “internal” (in C#)? Before today, I had no idea. Fortunately for me, one of my consultants had this exact problem last year. The solution:
[assembly: InternalsVisibleTo(“UnitTestAssemblyName”)]
Putting the following line in AssemblyInfo.cs for the assembly you wish to unit test makes everything declared “internal” available to UnitTestAssemblyName.
This is a vastly superior option to cloning the assembly you want to test and making all the internal members public.
“InternalsVisibleTo”
Nice. Thanks.
Definitely needed for testing Internal classes and other members.