I want to verify some logs logged. I am using the asp.net core built-in ILogger, and inject it with the asp.net core built-in DI:
private readonly ILogger<
I've written a short article showing a variety of approaches, including mocking the underlying Log() method as described in other answers here. The article includes a full GitHub repo with each of the different options. In the end, my recommendation is to use your own adapter rather than working directly with the ILogger type, if you need to be able to test that it's being called.
https://ardalis.com/testing-logging-in-aspnet-core