title: How to write mock implementation of async generic method
body: <p>I'm writing unit tests for my service class but it calls an external WCF service, so need to mock this calls. This is the interface of wrapper of external WCF service calls.</p>
  
  <pre><code>internal interface IKoopServiceRequestHelper
  {
  Task&lt;ServiceResponseDTO&gt; CreateRequestAsync(ServiceRequestDTO serviceRequestDTO);
  
  Task&lt;TResponse&gt; SendServiceMessagesAsync&lt;TRequest, TResponse&gt;(TRequest request, string messageCode)
      where TRequest : RequestDTO
      where TResponse : IResponseDTO;
  }
  </code></pre>
  
  <p>To mock real implementation of this interface I wrote a stub class like below.</p>
  
  <pre><code> class StubRequestHelper : IKoopServiceRequestHelper
  {
      public async Task&lt;ServiceResponseDTO&gt; CreateRequestAsync(ServiceRequestDTO serviceRequestDTO)
      {
          return await Task.FromResult(new ServiceResponseDTO());
      }
  }
  </code></pre>
  
  <p>But I cannot write a mock implementation of the second method named <code>SendServiceMessagesAsync</code> that has two generic type parameters. </p>