diff --git a/tests/Moq.ILogger.Tests/VerifyLogExtensionsTests.cs b/tests/Moq.ILogger.Tests/VerifyLogExtensionsTests.cs index 6afc644..1c19089 100644 --- a/tests/Moq.ILogger.Tests/VerifyLogExtensionsTests.cs +++ b/tests/Moq.ILogger.Tests/VerifyLogExtensionsTests.cs @@ -926,6 +926,39 @@ public void Verify_includes_the_fail_message_with_Times_Never() act.Should().ThrowExactly() .WithMessage("*Expected invocation on the mock should never have been performed, but was 1 time*"); } + + [Fact] + public void Verify_log_error_with_an_expected_event_id_and_message_it_verifies() + { + var loggerMock = new Mock(); + loggerMock.Object.LogError(50100, "the description of the error goes here"); + + Action act = () => loggerMock.VerifyLog(l => l.LogError(50100, It.IsAny()), Times.Once(), "an error must be logged"); + + act.Should().NotThrow(); + } + + [Fact] + public void Verify_log_error_with_an_expected_event_id_and_message_it_fails_with_expected_message() + { + var loggerMock = new Mock>(); + loggerMock.Object.LogError(50100, "the description of the error goes here"); + + Action act = () => loggerMock.VerifyLog(logger => logger.LogError(50200, "the description of the error goes here"), Times.Once(), "an error must be logged"); + + act.Should().ThrowExactly() + .WithMessage("*an error must be logged*") + .WithMessage("*Expected invocation on the mock once, but was 0 times*"); + } + + [Fact] + public void Verify_log_error_with_an_expected_event_id_and_message_it_fails_with_expected_message_fail_on_purpose() + { + var loggerMock = new Mock>(); + loggerMock.Object.LogError(50100, "the description of the error goes here"); + + loggerMock.VerifyLog(logger => logger.LogError(50200, "the description of the error goes here"), Times.Once(), "an error must be logged"); + } } internal static class OtherExtensions