How to Test Internal Methods in Visual Studio

Today I will show a very simple way on how to test internal methods in Visual Studio.

Let's say the internal methods to be tested are in an assembly named "MyApp", and the tests are located in an assembly named "MyApp.Tests". For the MyApp methods to be visible to the tests assembly, insert the following line in the AssemblyInfo file of MyApp:

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

With just this line of code, you will now be able to use and test the internal methods.