title: How can I invoke C# private Method<T>?, NUnit Testing
body: <p>I am trying to test a generic method but NUnit gives System.InvalidOperationException ... ContainsGenericParameters is true.</p>
  
  <p>I am using Microsoft.VisualStudio.QualityTools.UnitTestFramework</p>
  
  <p>There is the test code:</p>
  
  <pre><code>[Test]
      [Category("Private")]
      public async void TestConfirmedSendAsync()
      {
          var privProxy = new PrivateObject(_proxy);
          var task = (Task)privProxy.Invoke("ConfirmedAsyncTask");
          await task;
      }
  </code></pre>
  
  <p>And the method call is:</p>
  
  <pre><code>private async Task ConfirmedSendAsync&lt;T&gt;()
  </code></pre>
  
  <p>How can I make the generic call?</p>
  
  <p>The only way I could make it (without breaking private) is by creating private methods for each type I need...</p>
  
  <pre><code>private async Task ConfirmedSendStringAsync() { await ConfirmedSendAsync&lt;string&gt;();}
  </code></pre>
  
  <p>And the test:</p>
  
  <pre><code>[Test]
      [Category("Private")]
      public async void TestConfirmedSendAsync()
      {
          var privProxy = new PrivateObject(_proxy);
          var task = (Task)privProxy.Invoke("ConfirmedAsyncTaskString");
          await task;
      }
  </code></pre>