Sometimes you need to test classes and members that are not public but are internal to a project, such as during system testing, where you need to interact with UI elements directly. To have access to internal members, you must allow the test project access to the internal members of the main project. You do this by placing an InternalsVisibleTo
attribute into the AssemblyInfo
class of the main project, as shown:
[assembly: InternalsVisibleTo("WPUnleashed.Tests")]
The InternalsVisibleTo
attribute accepts a single parameter, which is the name of the assembly. If the test project has a strong name, the full name of the assembly must be used, including its public key token.
Examples of the InternalsVisibleTo
attribute are in the downloadable sample code.
3.145.52.86