07 March 2017

Unit testing internal methods / assembly: InternalsVisibleTo

For allowing internal methods to be testable from a specific assembly, you have been able to extend AssemblyInfo with


[assembly: InternalsVisibleTo("MyLib.Tests")]

Available since .Net 2.0.

Related information:
https://lostechies.com/jimmybogard/2007/10/12/double-edged-sword-of-internalsvisibleto/ http://theburningmonk.com/2010/05/net-tips-using-internalsvisibleto-attribute-to-help-testing-non-public-methods/
https://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute(v=vs.110).aspx

No comments: