title: How to instantiate PrivateType of inner private class
body: <p>I was trying to setup a unit test for a private inner class, but had very little success:</p>
  
  <pre><code>namespace Stats.Model
  {
    public class DailyStat
    {
      private class DailyStatKey // The one to test
      {
        private DateTime date;
        public DateTime Date 
        { 
          get { return date; }
          set { date = value.Date; }
        }
  
        public StatType Type { get; set; }
  
        public override int GetHashCode()
        {
          return Date.Year * 1000000 +
                 Date.Month * 10000 +
                 Date.Day * 100 +
                 (int)Type;
        }
  
        public override bool Equals(object obj)
        {
          DailyStatKey otherKey = obj as DailyStatKey;
          if (otherKey == null)
            return false;
          return (this.Date == otherKey.Date &amp;&amp; this.StatType == otherKey.StatType);
        }
      }
    }
  }
  </code></pre>
  
  <p>I tried this code:</p>
  
  <pre><code>PrivateType statKeyType = new PrivateType("Stats.Model", "Stats.Model.DailyStat.DailyStatKey");
  </code></pre>
  
  <p>as well as</p>
  
  <pre><code>PrivateType statKeyType = new PrivateType("Stats.Model", "DailyStat.DailyStatKey");
  </code></pre>
  
  <p>To no avail.</p>
  
  <p>The assembly's name is "Stats.Model", and to me the type name looks correct too, but I just get an exception: "System.TypeLoadException: Could not load type"</p>
  
  <p>So what am I doing wrong ?</p>
  
  <p>PrivateType, to the best of my knowledge, is reflection based, and I'd guess it's pretty much intended for this scenario, as you cannot have a private class directly beneath a namespace.</p>
  
  <p>EDIT:</p>
  
  <p>Added full implementation of DailyStatKey. What I want to test is the uniqueness of my GetHashCode method. As you can see I try to fit a date + type into a single int.</p>