Unit Testing

Unit Testing

Unit Testing ILogger in ASP.NET Core

I've been creating a new template solution for our ASP.NET Core projects. As I was writing some tests for an API controller, I hit a problem with mocking the ILogger<T> interface. So I thought I would write a quick blog post about what I found, mainly so I won't forget in the future!I had a se…

4 min read
Unit Testing

Unit Testing with the HttpClient

There has been a lot of discussion about how and even if the HttpClient class is testable. And it very much is.So I wanted to write a quick post giving you three options that you can use when you need to write tests involving the HttpClient.Let's assume we have a simple class which gets a list of so…

3 min read