public void LogLevel_LogValuesEventIdAndError_LogsCorrectValues(LogLevel logLevel, int eventId)
        {
            // Arrange
            var sink          = new TestSink();
            var logger        = SetUp(sink);
            var testLogValues = new TestLogValues()
            {
                Value = 1
            };

            // Act
            logger.Log(logLevel, eventId, _exception, testLogValues.ToString());

            // Assert
            Assert.True(sink.Writes.TryTake(out var write));
            Assert.Equal(logLevel, write.LogLevel);
            Assert.Equal(testLogValues.ToString(), write.State.ToString());
            Assert.Equal(eventId, write.EventId);
            Assert.Equal(_exception, write.Exception);
            Assert.Equal(
                "Test 1",
                write.Formatter(write.State, write.Exception));
        }
        public void LogValuesAndEventId_LogsCorrectValues()
        {
            // Arrange
            var sink          = new TestSink();
            var logger        = SetUp(sink);
            var testLogValues = new TestLogValues()
            {
                Value = 1
            };

            // Act
            logger.LogTrace(1, testLogValues.ToString());
            logger.LogInformation(2, testLogValues.ToString());
            logger.LogWarning(3, testLogValues.ToString());
            logger.LogError(4, testLogValues.ToString());
            logger.LogCritical(5, testLogValues.ToString());
            logger.LogDebug(6, testLogValues.ToString());

            // Assert
            Assert.Equal(6, sink.Writes.Count());

            Assert.True(sink.Writes.TryTake(out var trace));
            Assert.Equal(LogLevel.Trace, trace.LogLevel);
            Assert.Equal(1, trace.EventId);
            Assert.Null(trace.Exception);
            Assert.Equal("Test 1", trace.Formatter(trace.State, trace.Exception));

            Assert.True(sink.Writes.TryTake(out var information));
            Assert.Equal(LogLevel.Information, information.LogLevel);
            Assert.Equal(2, information.EventId);
            Assert.Null(information.Exception);
            Assert.Equal("Test 1", information.Formatter(information.State, information.Exception));

            Assert.True(sink.Writes.TryTake(out var warning));
            Assert.Equal(LogLevel.Warning, warning.LogLevel);
            Assert.Equal(3, warning.EventId);
            Assert.Null(warning.Exception);
            Assert.Equal("Test 1", warning.Formatter(warning.State, warning.Exception));

            Assert.True(sink.Writes.TryTake(out var error));
            Assert.Equal(LogLevel.Error, error.LogLevel);
            Assert.Equal(4, error.EventId);
            Assert.Null(error.Exception);
            Assert.Equal("Test 1", error.Formatter(error.State, error.Exception));

            Assert.True(sink.Writes.TryTake(out var critical));
            Assert.Equal(LogLevel.Critical, critical.LogLevel);
            Assert.Equal(5, critical.EventId);
            Assert.Null(critical.Exception);
            Assert.Equal("Test 1", critical.Formatter(critical.State, critical.Exception));

            Assert.True(sink.Writes.TryTake(out var debug));
            Assert.Equal(LogLevel.Debug, debug.LogLevel);
            Assert.Equal(6, debug.EventId);
            Assert.Null(debug.Exception);
            Assert.Equal("Test 1", debug.Formatter(debug.State, debug.Exception));
        }
        public void LogValuesEventIdAndError_LogsCorrectValues()
        {
            // Arrange
            var sink          = new TestSink();
            var logger        = SetUp(sink);
            var testLogValues = new TestLogValues()
            {
                Value = 1
            };

            // Act
            logger.LogTrace(1, _exception, testLogValues.ToString());
            logger.LogInformation(2, _exception, testLogValues.ToString());
            logger.LogWarning(3, _exception, testLogValues.ToString());
            logger.LogError(4, _exception, testLogValues.ToString());
            logger.LogCritical(5, _exception, testLogValues.ToString());
            logger.LogDebug(6, _exception, testLogValues.ToString());

            // Assert
            Assert.Equal(6, sink.Writes.Count);

            var trace = sink.Writes[0];

            Assert.Equal(LogLevel.Trace, trace.LogLevel);
            Assert.Equal(testLogValues.ToString(), trace.State.ToString());
            Assert.Equal(1, trace.EventId);
            Assert.Equal(_exception, trace.Exception);
            Assert.Equal(
                "Test 1",
                trace.Formatter(trace.State, trace.Exception));

            var information = sink.Writes[1];

            Assert.Equal(LogLevel.Information, information.LogLevel);
            Assert.Equal(testLogValues.ToString(), information.State.ToString());
            Assert.Equal(2, information.EventId);
            Assert.Equal(_exception, information.Exception);
            Assert.Equal(
                "Test 1",
                information.Formatter(information.State, information.Exception));

            var warning = sink.Writes[2];

            Assert.Equal(LogLevel.Warning, warning.LogLevel);
            Assert.Equal(testLogValues.ToString(), warning.State.ToString());
            Assert.Equal(3, warning.EventId);
            Assert.Equal(_exception, warning.Exception);
            Assert.Equal(
                "Test 1",
                warning.Formatter(warning.State, warning.Exception));

            var error = sink.Writes[3];

            Assert.Equal(LogLevel.Error, error.LogLevel);
            Assert.Equal(testLogValues.ToString(), error.State.ToString());
            Assert.Equal(4, error.EventId);
            Assert.Equal(_exception, error.Exception);
            Assert.Equal(
                "Test 1",
                error.Formatter(error.State, error.Exception));

            var critical = sink.Writes[4];

            Assert.Equal(LogLevel.Critical, critical.LogLevel);
            Assert.Equal(testLogValues.ToString(), critical.State.ToString());
            Assert.Equal(5, critical.EventId);
            Assert.Equal(_exception, critical.Exception);
            Assert.Equal(
                "Test 1",
                critical.Formatter(critical.State, critical.Exception));

            var debug = sink.Writes[5];

            Assert.Equal(LogLevel.Debug, debug.LogLevel);
            Assert.Equal(testLogValues.ToString(), debug.State.ToString());
            Assert.Equal(6, debug.EventId);
            Assert.Equal(_exception, debug.Exception);
            Assert.Equal(
                "Test 1",
                debug.Formatter(debug.State, debug.Exception));
        }