Esempio n. 1
0
            public static void NullLoggerCallbackAlowed()
            {
                var services = new ServiceCollection();

                services.AddSingleton <ApplicationInsightsLoggerEvents>();
                var serviceProvider = services.BuildServiceProvider();

                var loggerProvider = new MockLoggingFactory();

                loggerProvider.AddApplicationInsights(serviceProvider, (s, level) => true, null);
                loggerProvider.AddApplicationInsights(serviceProvider, (s, level) => true, null);
            }
Esempio n. 2
0
            public static void LoggerCallbackIsInvoked()
            {
                var services = new ServiceCollection();

                services.AddSingleton <ApplicationInsightsLoggerEvents>();
                var serviceProvider = services.BuildServiceProvider();

                var loggerProvider = new MockLoggingFactory();

                bool firstLoggerCallback  = false;
                bool secondLoggerCallback = false;

                loggerProvider.AddApplicationInsights(serviceProvider, (s, level) => true, () => firstLoggerCallback  = true);
                loggerProvider.AddApplicationInsights(serviceProvider, (s, level) => true, () => secondLoggerCallback = true);

                Assert.True(firstLoggerCallback);
                Assert.False(secondLoggerCallback);
            }