title: How to pass in a mocked HttpClient in a .NET test?
body: <p>I have a service which uses <code>Microsoft.Net.Http</code> to retrieve some <code>Json</code> data. Great!</p>
  
  <p>Of course, I don't want my unit test hitting the actual server (otherwise, that's an integration test).</p>
  
  <p>Here's my service ctor (which uses dependency injection...)</p>
  
  <pre><code>public Foo(string name, HttpClient httpClient = null)
  {
  ...
  }
  </code></pre>
  
  <p>I'm not sure how I can mock this with ... say .. <code>Moq</code> or <code>FakeItEasy</code>.</p>
  
  <p>I want to make sure that when my service calls <code>GetAsync</code> or <code>PostAsync</code> .. then i can fake those calls.</p>
  
  <p>Any suggestions how I can do that?</p>
  
  <p>I'm -hoping- i don't need to make my own Wrapper .. cause that's crap :( Microsoft can't have made an oversight with this, right?</p>
  
  <p>(yes, it's easy to make wrappers .. i've done them before ... but it's the point!)</p>