private void TraceMessagesUsingListener(FormattedAppInsightsTraceListener listener, LogEntry logEntry)
        {
            Assert.IsNotNull(listener);

            foreach (var categorySource in logEntry.Categories)
            {
                listener.TraceData(new TraceEventCache(), categorySource, logEntry.Severity, logEntry.EventId, logEntry);
            }
        }
        private static void VerifyListenerConfigurationAgainstAppConfig(FormattedAppInsightsTraceListener listenerConfigured)
        {
            Assert.IsNotNull(listenerConfigured);

            Assert.AreEqual(ConfigurationTestHelper.ConditionalListenerName, listenerConfigured.Name);

            var key = listenerConfigured.InstrumentationKey;

            Assert.AreEqual(ConfigurationTestHelper.InstrumentaionKey, key);
        }
        private void ModifyListenerChannelFromAdapterHelper(FormattedAppInsightsTraceListener listener)
        {
            if (listener == null)
            {
                return;
            }
            listener.TelemetryClient = GetTelemetryClientWithCustomChannel();

            LogSource logSource;

            this.writer.TraceSources.TryGetValue("General", out logSource);
        }
        public void LogByApplyingFilter()
        {
            var listener = new FormattedAppInsightsTraceListener(this.adapterHelper.InstrumentationKey, new TextFormatter("TEST{newline}TEST"))
            {
                Filter = new EventTypeFilter(SourceLevels.Information)
            };

            listener.TelemetryClient = GetTelemetryClientWithCustomChannel();

            listener.TraceData(new TraceEventCache(), "MockCateogry", TraceEventType.Error, 0, new LogEntry("message", "MockCateogry", 0, 0, TraceEventType.Error, "title", null));

            Assert.AreEqual(true, this.adapterHelper.Channel.SentItems.Length == 1);
        }