private void AssertExpectedLogLevel(LoggingTraceListener listener, TraceEventType eType, LogLevelType level)
        {
            var adapter = (CapturingLoggerAdapter)LogManager.Adapter;

            adapter.Clear();
            listener.TraceEvent(null, "sourceName " + eType, eType, -1, "format {0}", eType);
            var logName    = adapter.LastEvent.Source.ArgumentEntity.LogName;
            var exceptName = string.Format("{0}.{1}", listener.Name, "sourceName " + eType);

            logName.Should().Be(exceptName);
            adapter.LastEvent.Level.Should().Be(level);
            adapter.LastEvent.RenderedMessage.Should().Be("format " + eType);
            adapter.LastEvent.Exception.Should().BeNull();
        }
        public void logging_not_log_below_filter_level_test()
        {
            var adapter = new CapturingLoggerAdapter();

            LogManager.Adapter = adapter;

            var listener = new LoggingTraceListener();

            listener.Filter = new EventTypeFilter(SourceLevels.Warning);
            adapter.Clear();
            listener.TraceEvent(null, "sourceName", TraceEventType.Information, -1, "format {0}", "Information");
            adapter.LastEvent.Should().BeNull();

            AssertExpectedLogLevel(listener, TraceEventType.Warning, LogLevelType.Warn);
            AssertExpectedLogLevel(listener, TraceEventType.Error, LogLevelType.Error);
        }