Unit Test Non-Public Methods in C# Unit Tests

To expose non-public methods to the test project, you need to mark the assembly with an attribute called InternalsVisibleTo in the asemblyinfo.cs file??

For example:

[assembly: InternalsVisibleTo("testProjectName")]

You need to mark the methods as Internal, and they will available for you to test in the test project.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Related Posts