Friday, March 21, 2008 11:45 AM
michaelc
InternalsVisibleToAttribute
Here's something I came across in the IronPython sources that I really hadn't noticed in the .Net Framework before.
[assembly: InternalsVisibleTo("IronPython.Modules")]
This is from the MSDN documention on the Attribute:
.NET Framework Class Library
InternalsVisibleToAttribute Class
Specifies that types that are ordinarily visible only within the current assembly are visible to another assembly.
Namespace: System.Runtime.CompilerServices
Assembly: mscorlib (in mscorlib.dll)
This seems like it would be a great way to expose your classes to unit testing without having to ship your tests. It also makes it easy for you to split large collections of classes that need internal access to each other into multiple assemblies to update them independently. Even though as I write that it makes me think that if you have that situation, you need to refactor and break those internal dependecies. :)