I have been looking at Enterprise Library 3.0 more this weekend and discovered something I thought was noteworthy.
If you have an assembly that has members that you want available to another assembly (say, a test assembly), but don’t want have all your internal types visible to other client assemblies, you can use the InternalsVisibleToAttribute in your AssemblyInfo.cs.
A common complaint about unit testing is that you have to make everything public and accessible, possibly breaking your intended design for the sake of testability. You can correct that issue by adding this attribute to your target assembly’s AssemblyInfo.cs file:
If the assembly that you are trying to make the internals visible from is signed with a strong-name key, you need to specify the PublicKey of the strong-name key that you signed your assembly with.
To find out the Public Key of your assembly you can issue the following commands:
sn.exe -p MyKey.snk mykey.pub
sn.exe -tp mykey.pub
Then you can assign the PublicKey value in the InternalsVisibleToAttribute as follows:
[assembly: InternalsVisibleTo("MyTestAssembly, PublicKey=