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
The following code causes Typemock to fail.
internal interface IInternalInterface
{
List<string> SomeFunc(int someArg);
}

[TestClass, Isolated]
public class FakingInternalInterfaceTest
{
[TestMethod]
public void FakingInternalInterface()
{
var provider = Isolate.Fake.Instance<IInternalInterface>();
provider.SomeFunc(1);
}
}

Is faking internal interfaces not supported?
asked by krok (3.9k points)

3 Answers

0 votes
Hi,

The problem is because the interface is internal.
To solve this problem simply use the InternalsVisibleTo attribute in the AssemblyInfo.cs file of the project that contains the interface like this:

[assembly: InternalsVisibleTo("DynamicMockAssembly")]


Please let me know if it helps.
answered by ohad (35.4k points)
0 votes
Thanks it worked just fine.
answered by krok (3.9k points)
0 votes
Thanks it worked just fine.
answered by krok (3.9k points)
...