title: how to unittest private method in c# with PrivateObject
body: <p>Im trying to make a simple unit test of a private method and I let VS2010 autogenerate the method stubb and add the missing info: This is the code I have</p>
  
  <pre><code>[TestMethod()]
          [DeploymentItem("MyPackage.Language.dll")]
          public void getValidCultureWithValidInputCulture()
          {
              CultureInfo culture = new CultureInfo("sv-SE", false);
              PrivateObject param0 = new PrivateObject(culture, new PrivateType(typeof(CultureInfo)));
              GlobalResourceProvider_Accessor target = new GlobalResourceProvider_Accessor(param0);
              CultureInfo expected = new CultureInfo("sv-SE", false); 
              CultureInfo actual = target.getValidCulture(culture);
              Assert.AreEqual(expected, actual);
              Assert.Inconclusive("Verify the correctness of this test method.");
          }
  </code></pre>
  
  <p>When I run this I get a exception:</p>
  
  <pre><code>System.ArgumentException: 
        The member specified (getValidCulture) could not be found. You might need to regenerate your private accessor,
        or the member may be private and defined on a base class. If the latter is true, you need to pass the type
        that defines the member into PrivateObject's constructor.
  </code></pre>
  
  <p>Does anyone know what i´m doing wrong here? My Objective is to learn how to use the PrivateType and PrivateObject for private methods testing.</p>
  
  <p>EDIT:</p>
  
  <p>Im not not looking to use the PrivateObject.Invoke (it's not refactor friendly).</p>