title: How to use generics containing private types with Visual Studio Unit Tests
body: <p>I have an issue with a class that I'm trying to test.  I've declared a private enum and I'm using that in a generic dictionary in the code.  This enum has no meaning outside of this class but it's used in a private method.  When I generated the code the accessor is written into the generic dictionary type, but throws an invalid cast exception when I try to use the test.</p>
  
  <pre><code>MyClass_Accessor target = new MyClass_Accessor();
  Dictionary&lt;MyClass_Accessor.MyEnum, long&gt; dictionary = new Dictionary&lt;MyClass_Accessor.MyEnum, long&gt;();
  dictionary.Add(MyClass_Accessor.Myenum.EnumValue, 1);
  target.Method(dictionary); //Throws invalid cast exception here.
  </code></pre>
  
  <p>The exception is that the generic dictionary of accessor => enum, long cannot be converted to Myclass => enum, long.</p>
  
  <p><em>Other than altering my working class</em>, is there a way that I can test this method?</p>