I have a service which uses Microsoft.Net.Http to retrieve some Json data. Great!
Of course, I don't want my unit test hitting the actual server (otherwise, that's an integration test).
Here's my service ctor (which uses dependency injection...)
public Foo(string name, HttpClient httpClient = null) { ... } I'm not sure how I can mock this with ... say .. Moq or FakeItEasy.
I want to make sure that when my service calls GetAsync or PostAsync .. then i can fake those calls.
Any suggestions how I can do that?
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?
(yes, it's easy to make wrappers .. i've done them before ... but it's the point!)
HttpClient's methods and properties do you use? It can usually prove useful to create an interface for those, which you can then mock.