How to do internal interfaces visible for Moq?

前端 未结 1 1939
名媛妹妹
名媛妹妹 2021-02-01 01:16

I have 3 project in my C# solution.

  • Signatures
  • Structures
  • Tests

Signatures has public and internal interfaces. Also it has

相关标签:
1条回答
  • 2021-02-01 02:06

    The suggested fix message uses a const/static field for the assembly name:

    [assembly: InternalsVisibleTo(InternalsVisible.ToDynamicProxyGenAssembly2)]
    

    You used a string which does not correspond to the assembly name:

    [assembly: InternalsVisibleTo("InternalsVisible.DynamicProxyGenAssembly2")] 
    

    Change it to:

    [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] 
    

    You can see the actual assembly name (which should appear in InternalsVisibleTo) in your error message:

    Type 'Castle.Proxies.IReminiscenceableDataTableProxy' from assembly 'DynamicProxyGenAssembly2 (...)

    0 讨论(0)
提交回复
热议问题