To use this attribute, your test assembly must be strong-named. Then you put InternalsVisibleTo attribute with public key of test assembly into AssemblyInfo.cs file of assembly under test.
I created an Assembly Helper tool that creates the syntax for you. The tool is working (or should work) with following languages:
You can get the tool from here.
Steps to use InternalsVisibleTo attribute with the tool.
Let assume that you have Assm_A and Assm_ATests.
- Sign Assm_A and Assm_ATests with a Strong Name. You can read about that here.
- Compile your assemblies.
- Launch Assembly Helper tool .
- Select desired language and press on ‘Get Assemblies’ button and navigate to Assm_ATests.dll.
- Copy the text into AssemblyInfo file of Assm_A assembly.
Now your tests can access internals members of the assembly under test.
Note: With Assembly Helper tool you can select multiple assemblies at once.