dcsimg
LinkedIn
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: .NET
Expertise: Advanced
Jan 30, 2020

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.

Srinath M S
 
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date