How to write tests for HttpClient using Moq

from blog Just Some Code, | ↗ original
This post is part of my Advent of Code. These days I needed to unit test a service that used the built-in HttpClient. It wasn’t as easy as creating a fake for HttpClient. This is how to write tests for HttpClient with Moq and a set of extension methods to make it easier. To write tests for a service that requires a HttpClient, create a fake for...