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<
As @Nkosi've already said, you can't mock an extension method. What you should mock, is the ILogger.Log method, which LogError calls into. It makes the verification code a bit clunky, but it should work:
MockLogger.Verify(
m => m.Log(
LogLevel.Error,
It.IsAny(),
It.Is(v => v.ToString().Contains("CreateInvoiceFailed")),
It.IsAny(),
It.IsAny>()
)
);
(Not sure if this compiles, but you get the gist)