Esempio n. 1
0
        public void TestLoggerCreatesTraceTelemetryWithoutEventIdOnLoggedDebug()
        {
            TelemetryClient client = CommonMocks.MockTelemetryClient((t) =>
            {
                Assert.IsType <TraceTelemetry>(t);
                var traceTelemetry = (TraceTelemetry)t;
                Assert.Equal("This is an information", traceTelemetry.Message);
                Assert.Equal(SeverityLevel.Verbose, traceTelemetry.SeverityLevel);
                Assert.Equal("test-category", traceTelemetry.Properties["CategoryName"]);

                Assert.False(traceTelemetry.Properties.ContainsKey("EventId"));
                Assert.False(traceTelemetry.Properties.ContainsKey("EventName"));
            });

            ILogger logger = new ApplicationInsightsLogger("test-category", client, (s, l) => { return(true); }, null);

            logger.LogDebug(new EventId(22, "TestEvent"), "This is an information");
        }