title: How do I unit test an adapter class?
body: <p>Suppose I have the following classes from a third-party library:</p>
  
  <pre><code>public class ThirdPartyType { ... }
  
  public class ThirdPartyFunction
  {
      public ThirdPartyType DoSomething() { ... }
  }
  </code></pre>
  
  <p>The implementation details are not important, and they are actually outside of my control for this third-party library.</p>
  
  <p>Suppose I write an adapter class for <code>ThirdPartyFunction</code>:</p>
  
  <pre><code>public class Adapter
  {
      private readonly ThirdPartyFunction f;
  
      public Adapter()
      {
          f = new ThirdPartyFunction();
      }
  
      public string DoSomething()
      {
          var result = f.DoSomething();
  
          // Convert to a type that my clients can understand
          return Convert(result);
      }
  
      private string Convert(ThirdPartyType value)
      {
          // Complex conversion from ThirdPartyType to string
          // (how do I test this private method?)
          ...
      }
  }
  </code></pre>
  
  <p>How can I test that my implementation of <code>Convert(ThirdPartyType)</code> is correct? It's only needed by the <code>Adapter</code> class, which is why it's a private method.</p>