chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
Hi all,

I have a method to test in which I am creating instance of an internal class and calling its method (of internal class). But I am able to mock that method of an internal class in my testing project.
Kindly let me know how can I mock a method of an internal class for testing purpose. Thanks
asked by sony (7.2k points)

1 Answer

0 votes
Hi Sony,

Internal classes can be tested just like any public class, provided you enable your testing project to access internal members on your production project. You can do this by adding the InternalsVisibleTo attribute to your AssemblyInfo.cs on the production project. You can see more about using this attribute here: http://msdn.microsoft.com/en-us/library ... ibute.aspx.

Another option is to use our non-public API, which I believe (following previous posts) you are familiar with.

Hope this helps!
Doron
Typemock Support
answered by doron (17.2k points)
...