title: How to do internal interfaces visible for Moq?
body: <p>I have 3 projects in my C# solution.</p>
  <ul>
  <li>Signatures</li>
  <li>Structures</li>
  <li>Tests</li>
  </ul>
  <p>Signatures have public and internal interfaces.
  Also, it has</p>
  <pre><code>  [assembly: InternalsVisibleTo(&quot;Structures&quot;)]
    [assembly: InternalsVisibleTo(&quot;Tests&quot;)]
  </code></pre>
  <p>in AssemblyInfo.cs of.</p>
  <p>Structures have public and internal classes and</p>
  <pre><code>  [assembly: InternalsVisibleTo(&quot;Tests&quot;)]
  </code></pre>
  <p>in AssemblyInfo.cs of.</p>
  <p>Tests has next source:</p>
  <pre><code>&lt;packages&gt;
    &lt;package id=&quot;Moq&quot; version=&quot;4.2.1409.1722&quot; targetFramework=&quot;net45&quot; /&gt;
    &lt;package id=&quot;NUnit&quot; version=&quot;2.6.4&quot; targetFramework=&quot;net45&quot; /&gt;
    &lt;package id=&quot;NUnitTestAdapter&quot; version=&quot;1.2&quot; targetFramework=&quot;net45&quot; /&gt;
  &lt;/packages&gt;
  </code></pre>
  <p>as NuGet packages in packages.config.</p>
  <p>I wrote an unit test for the internal interface from Signatures and internal class from Structures. Run, and had next result: exception:</p>
  <p><strong>Type Signatures.InterfaceX is not visible to DynamicProxy. Can not create proxy for types that are not accessible. Make the type public, or internal and mark your assembly with [assembly: InternalsVisibleTo(InternalsVisible.ToDynamicProxyGenAssembly2)] attribute.</strong></p>
  <p>Seems logical. I added</p>
  <pre><code>[assembly: InternalsVisibleTo(&quot;InternalsVisible.DynamicProxyGenAssembly2&quot;)] 
  </code></pre>
  <p>to assembly info of Signatures and Structures projects. Run, and had next result: exception:</p>
  <p><strong>Type 'Castle.Proxies.IReminiscenceableDataTableProxy' from assembly 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is attempting to implement an inaccessible interface.</strong></p>
  <p>I expected it would help but it didn't.
  It only changed the exception message.</p>
  <p>How to fix my problem?</p>