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<
After some upgrades to .net core 3.1 FormattedLogValues become internal. We can not access it anymore. I made a extensions method with some changes. Some sample usage for extension method:
mockLogger.VerifyLog(Times.Once);
public static void VerifyLog(this Mock> mockLogger, Func times)
{
mockLogger.Verify(x => x.Log(
It.IsAny(),
It.IsAny(),
It.Is((v, t) => true),
It.IsAny(),
It.Is>((v, t) => true)), times);
}