Monday, June 10, 2013

Hide your methods being tested using InternalsVisibleTo

It is not necessary to expose all methods being tested as public when using an external test project. By using the assembly attribute InternalsVisibleTo and specifying the namespace of the "friend" assembly, the visibility of the methods can then be reduced to internal, hiding them from all other assemblies. 

In the project's AssemblyInfo.cs 
[assembly: InternalsVisibleTo("MyAssembly.Tests")]
Post a Comment

Find a cool free stuff everyday

Giveaway of the Day

Hiren Bharadwa's Posts

DotNetJalps