title: C# test private static method of public static class
body: <p>I'm a little confused about how to perform these test. I know about the existence of <code>PrivateObject</code> to test private class and <code>PrivateType</code> to test private static class, but how can I test a private static method of a PUBLIC static class?</p>
  
  <pre><code>public static class Clients {
      // CUT
      private static List&lt;string&gt; GenerateAddresses(string AppPath) {
          // CUT
      }
  }
  </code></pre>
  
  <p>In my unit test class I tried</p>
  
  <pre><code>PrivateType testClients = new PrivateType(Clients);
  </code></pre>
  
  <p>but I get the error</p>
  
  <blockquote>
    <p>'Clients' is a type, which is not valid in the given context</p>
  </blockquote>
  
  <p>The error is a bit confusing and google bring me to completly different problems. Am I using 'Clients' wrong with <code>PrivateType</code>? Or should I test in a different way given that <code>Clients</code> is public?</p>