In the following code, I check for any LogErrors in the ILogger instance. However, I would like to verify that the ILogger instance does not contain any LogError entries. Can you help?
target.ProcessMainframeJobs(stream, filename, processorlog.Object, testBase.executionContext);
processorlog.Verify(logger => logger.Log(
It.Is<LogLevel>(logLevel => logLevel == LogLevel.Error),
It.Is<EventId>(eventId => eventId.Id == 0),
It.Is<It.IsAnyType>((@object, @type) => @object.ToString().Contains("Failed") && @type.Name == "FormattedLogValues"),
It.IsAny<Exception>(),
It.IsAny<Func<It.IsAnyType, Exception, string>>()),
Times.Once);
}
LogLevel
and accept anything for any other parametersTimes.Never
loggerMock.Verify(l => l.Log(
LogLevel.Error,
It.IsAny<EventId>(),
It.IsAny<It.IsAnyType>(),
It.IsAny<Exception>(),
(Func<It.IsAnyType, Exception, string>)It.IsAny<object>()),
Times.Never);