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
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
Okay, my first line of code ever is giving me an error:
Isolate.Fake.Instance<ILoginScreen>(Members.MustSpecifyReturnValues);

Results in:
System.TypeLoadException: Type 'Mock0000ILoginScreen' from assembly 'DynamicMockAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=a0857b23fb3f20d9' is attempting to implement an inaccessible interface..

The interface is marked as "internal" in the DLL I'm unit testing. I've used the [InternalsVisibleTo] to make it accessible to the test DLL. I can work around this by adding:
[assembly: InternalsVisibleTo("DynamicMockAssembly")]

But I figured mocking internals was no sweat for TypeMock.
asked by MobyDisk (3.6k points)

2 Answers

0 votes
From Typemock Isolator documentation:

In .NET 2.0 you can mock the internal interfaces if you give Typemock Isolator the correct permissions, as follows:
In the AssemblyInfo of the internal interface assembly, add
[assembly: InternalsVisibleTo("DynamicMockAssembly")]
answered by dhelper (11.9k points)
0 votes
Sounds like I did the right thing then. Thanks!
answered by MobyDisk (3.6k points)
...