public SerilogTraceWriterShould()
        {
            IFixture fixture = new Fixture().Customize(new AutoMoqCustomization());

            _loggerMock = fixture.Create <Mock <ILogger> >();
            _loggerMock.Setup(l => l.ForContext(It.IsAny <string>(), It.IsAny <object>(), It.IsAny <bool>()))
            .Returns(_loggerMock.Object);

            // Create the system under test.
            _sut = new SerilogTraceWriter(TraceLevel.Info, () => _loggerMock.Object);
        }
        public void WriteToTheGlobalLoggerIfNoneSpecified()
        {
            // Arrange - Use a different constructor to test whether the global logger is used.
            var sut = new SerilogTraceWriter(TraceLevel.Info);

            // Set-up the global logger to be the mocked logger.
            Log.Logger = _loggerMock.Object;

            const string message    = "Some Random Message";
            TraceEvent   traceEvent = CreateTraceEvent(TraceLevel.Error, message);

            // Act
            sut.Trace(traceEvent);

            // Assert
            _loggerMock.Verify(l => l.Write(LogEventLevel.Error, default(Exception), message), Times.Once);
        }