I have a class that receives an ILogger and I want to mock the LogInformation calls but this is an extension method. How do I make the appropiate setup call for this?
If you're using Moq >= 4.13, here is a way to mock ILogger:
logger.Verify(x => x.Log(
It.IsAny(),
It.IsAny(),
It.IsAny(),
It.IsAny(),
(Func)It.IsAny
You can change the It.IsAny, It.IsAny, and It.IsAny stubs to be more specific, but using It.IsAnyType is necessary because FormattedLogValues is now internal.
Reference: TState in ILogger.Log used to be object, now FormattedLogValues