public void UsesCallerInfo()
            {
                // Arrange
                LoggerDiagnosticsSource.TraceState state = null;
                _logger
                .Setup(x => x.Log(
                           It.IsAny <LogLevel>(),
                           It.IsAny <EventId>(),
                           It.IsAny <LoggerDiagnosticsSource.TraceState>(),
                           It.IsAny <Exception>(),
                           It.IsAny <Func <LoggerDiagnosticsSource.TraceState, Exception, string> >()))
                .Callback <LogLevel, EventId, LoggerDiagnosticsSource.TraceState, Exception, Func <LoggerDiagnosticsSource.TraceState, Exception, string> >(
                    (_, __, s, ___, ____) => state = s);

                // Act
                _target.TraceEvent(
                    _traceEventType,
                    _id,
                    _message);

                // Assert
                Assert.NotNull(state);
                Assert.NotNull(state.Member);
                Assert.NotEqual(string.Empty, state.Member);
                Assert.NotNull(state.File);
                Assert.NotEqual(string.Empty, state.File);
                Assert.NotEqual(default(int), state.Line);
            }
            public void LogsCorrectState()
            {
                // Arrange
                LoggerDiagnosticsSource.TraceState state = null;
                _logger
                .Setup(x => x.Log(
                           It.IsAny <LogLevel>(),
                           It.IsAny <EventId>(),
                           It.IsAny <LoggerDiagnosticsSource.TraceState>(),
                           It.IsAny <Exception>(),
                           It.IsAny <Func <LoggerDiagnosticsSource.TraceState, Exception, string> >()))
                .Callback <LogLevel, EventId, LoggerDiagnosticsSource.TraceState, Exception, Func <LoggerDiagnosticsSource.TraceState, Exception, string> >(
                    (_, __, s, ___, ____) => state = s);

                // Act
                _target.TraceEvent(
                    _traceEventType,
                    _id,
                    _message,
                    _member,
                    _file,
                    _line);

                // Assert
                Assert.NotNull(state);
                Assert.Equal(_traceEventType, state.TraceEventType);
                Assert.Equal(_id, state.Id);
                Assert.Equal(_message, state.Message);
                Assert.Equal(_member, state.Member);
                Assert.Equal(_file, state.File);
                Assert.Equal(_line, state.Line);

                var pairs = Assert.IsAssignableFrom <IEnumerable <KeyValuePair <string, object> > >(state);

                Assert.Equal(new[] { "File", "Id", "Line", "Member", "Message", "TraceEventType" }, pairs.Select(x => x.Key).OrderBy(x => x));
                var pairDictionary = pairs.ToDictionary(x => x.Key, x => x.Value);

                Assert.Equal(_traceEventType, pairDictionary["TraceEventType"]);
                Assert.Equal(_id, pairDictionary["Id"]);
                Assert.Equal(_message, pairDictionary["Message"]);
                Assert.Equal(_member, pairDictionary["Member"]);
                Assert.Equal(_file, pairDictionary["File"]);
                Assert.Equal(_line, pairDictionary["Line"]);
            }
            public void MapsToTraceEventType(LogLevel logLevel, TraceEventType traceEventType)
            {
                // Arrange
                LoggerDiagnosticsSource.TraceState state = null;
                _logger
                .Setup(x => x.Log(
                           It.IsAny <LogLevel>(),
                           It.IsAny <EventId>(),
                           It.IsAny <LoggerDiagnosticsSource.TraceState>(),
                           It.IsAny <Exception>(),
                           It.IsAny <Func <LoggerDiagnosticsSource.TraceState, Exception, string> >()))
                .Callback <LogLevel, EventId, LoggerDiagnosticsSource.TraceState, Exception, Func <LoggerDiagnosticsSource.TraceState, Exception, string> >(
                    (_, __, s, ___, ____) => state = s);

                // Act
                _target.TraceEvent(
                    logLevel,
                    new EventId(_id),
                    _message,
                    _member,
                    _file,
                    _line);

                // Assert
                Assert.Equal(traceEventType, state.TraceEventType);
                Assert.Equal(_id, state.Id);

                _logger.Verify(
                    x => x.Log(
                        logLevel,
                        _id,
                        state,
                        null,
                        It.IsAny <Func <LoggerDiagnosticsSource.TraceState, Exception, string> >()),
                    Times.Once);
            }