Implementing a custom log provider in tests

As we already have seen, the logging system of ASP.NET Core is designed for maximum extensibility. In this section, we will learn how to implement a custom logging provider that we can use in our tests. All the test classes that are present in the Catalog.API.Tests project use InMemoryApplicationFactory<T> to run a web server and provide HttpClient to call the API. As you may have noticed, the tests don't return an explicit error when one of the tests fails. For example, let's examine the following test method in the ItemControllerTests class:

public class ItemController : IClassFixture<InMemoryApplicationFactory<Startup>>    {        ...            [Fact]        public async Task update_should_returns_not_found _when_item_is_not_present ...

Get Hands-On RESTful Web Services with ASP.NET Core 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.