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
In Assembly "A", define a internal class

internal abstract class InternalClass
{
} 


In the "A" assemblyinfo.cs, make sure that Assembly "B" can see the internal of "A"
[assembly: InternalsVisibleTo("B")]


"B" is the test class of "A".

In "B", try to use this command:
 Isolate.Fake.Instance<A>()


Although the code can compile, but it fails under Isolator because of System.TypeLoadException.

This, I think is a bug because I usually use
[assembly: InternalsVisibleTo("UnitTest")]

pattern for my unit testing class
________
Coach Handbags
asked by nsoonhui (59.1k points)

2 Answers

0 votes
Hi,

In order to fake internal abstract type and interfaces, the assembly must be visible to DynamicMockAssembly too.

[assembly: InternalsVisibleTo("DynamicMockAssembly")]


Please let me know if it works.

Regards,
Elisha,
Typemock Support
answered by Elisha (12k points)
0 votes
It works, thanks!
________
VOYEUR ASIAN
answered by nsoonhui (59.1k points)
...