Well don't shoot the messenger.
- Visual Studio Unit testing (aka tests that run with MSTest.exe) only test managed code. You can't test unmanaged C++. There is a new native unit testing framework coming with VS11 (the next version).
- InternalsVisibleTo like you said also applies only to managed code.
- IMHO You usually don't need to test internal classes. Just like private types or methods, you test them via the public/exposed methods that use them. So if PublicA.Method1() is the way your clients would exercise InternalHelper.Method2() ; then I rely on the test for PublicA.Method1() to tell me if either of them is broken.
- If you must test internal classes, try making them public (if methods are sufficient complex.. see MethodObject refactoring). Or you could make the test classes a friend of the internal classes.
.
class ProductionSUT
{
// production code to be tested
friend class TestProductSUT;
}
Disclaimer: Haven't tried this out.. so may need some tweaks to pacify the compiler.