[Of course, the question is not restricted to a specific "friend" implementation, feel free though to point out implementation specifics if relevant]
Reading through the unanswered questions, I stumbled upon the InternalsVisibleTo
attribute:
Specifies that types that are ordinarily visible only within the current assembly are visible to another assembly.
The C# Programming Guide on MSDN has a section Friend Assemblies describing how to use the attribute to allow the use of internal
methods and types to another assembly.
I'm wondering whether it would be a Good Idea to use this to create a "hidden" interface for instrumenting a library for use by the unit testing assembly. It seems to increase coupling massively in both directions (testing code in the production assembly, intimate internal knowledge about the production assembly in testing code), but on the other hand it might help in creating fine-grained tests without cluttering the public interface.
What is your experience with using friend declarations when testing? Was it your Silver Bullet, or did it start the Death March?