Пример #1
0
        public void TestWriteWindowsEventListenerSucceeds()
        {
            var eventSource = Logger.Log;

            var analyzer = new EventSourceAnalyzer();

            analyzer.Inspect(eventSource);

            var eventLogParams = new WindowsEventLogParams()
            {
                EventLevel   = System.Diagnostics.Tracing.EventLevel.LogAlways,
                EventSource  = eventSource,
                InstanceName = "TestLogger",
                Keywords     = System.Diagnostics.Tracing.EventKeywords.All,
                SourceName   = "TestLogger"
            };

            var listener = new EventLogListenerFactory().CreateEventListener(eventLogParams);

            Assert.IsInstanceOfType(listener, typeof(WindowsEventLogListener));


            Logger.Log.AppStarted();

            var testLog = new EventLog();

            testLog.Log = "TestLogger";
            var entries = testLog.Entries;

            Assert.IsNotNull(entries);
            Assert.AreEqual(1, entries.Count);
        }
Пример #2
0
        public void StandardLogEventSource_Verify()
        {
            var analyzer = new EventSourceAnalyzer
            {
                ExcludeWriteEventTypeOrder = true
            };

            analyzer.Inspect(StandardLogEventSource.Log);
        }
Пример #3
0
        public void PerformanceLogEventSource_Verify()
        {
            var analyzer = new EventSourceAnalyzer
            {
                ExcludeWriteEventTypeOrder = true
            };

            analyzer.Inspect(PerformanceLogEventSource.Log);
        }
Пример #4
0
        public void BlueprintEventSource_Verify()
        {
            var analyzer = new EventSourceAnalyzer
            {
                ExcludeWriteEventTypeOrder = true
            };

            analyzer.Inspect(BlueprintEventSource.Log);
        }
        public void Inspect()
        {
            // arrange
            EventSourceAnalyzer analyzer = new EventSourceAnalyzer();

            // act
            Report report = analyzer.Inspect(RequestActivityEventSource.Log);

            // assert
            Assert.False(report.HasErrors);
        }
Пример #6
0
        public void Analyze()
        {
            // arrange
            EventSourceAnalyzer analyzer = new EventSourceAnalyzer();

            // act
            Report report = analyzer.Inspect(ApplicationEventSource.Log);

            // assert
            Assert.False(report.HasErrors);
        }
Пример #7
0
        public void Inspect_HotChocolateActivityEventSource()
        {
            // arrange
            var analyzer = new EventSourceAnalyzer();

            // act
            Report report = analyzer.Inspect(
                HotChocolateActivityEventSource.Log);

            // assert
            Assert.False(report.HasErrors);
        }
Пример #8
0
        public void TestCreateMultipleLogListenersSucceeds()
        {
            var eventSource = Logger.Log;

            var analyzer = new EventSourceAnalyzer();

            analyzer.Inspect(eventSource);

            var windowsEventLogParams = new WindowsEventLogParams()
            {
                EventLevel   = System.Diagnostics.Tracing.EventLevel.LogAlways,
                EventSource  = eventSource,
                InstanceName = "TestLogger",
                Keywords     = System.Diagnostics.Tracing.EventKeywords.All,
                SourceName   = "TestLogger"
            };


            var databaseEventLogParams = new DatabaseEventLogParams()
            {
                EventLevel       = System.Diagnostics.Tracing.EventLevel.LogAlways,
                EventSource      = eventSource,
                InstanceName     = "Logger",
                ConnectionString = "data source=blah;initial catalog=Logging;User ID='CarePointDMEBetaAdmin';Password='******';MultipleActiveResultSets=True;App=EntityFramework",
                Keywords         = System.Diagnostics.Tracing.EventKeywords.All,
                TableName        = "dbo.Traces"
            };

            var factory = new EventLogListenerFactory();
            //var windowsEventListener = factory.CreateEventListener(windowsEventLogParams);
            var databaseEventListener = factory.CreateEventListener(databaseEventLogParams);

            Logger.Log.AppStarted();

            /*
             * var testLog = new EventLog();
             * testLog.Log = "TestLogger";
             * var entries = testLog.Entries;
             * Assert.IsNotNull(entries);
             * Assert.AreEqual(1, entries.Count);
             */
        }
    public void MyEventSourceShouldBeValid()
    {
        var analyzer = new EventSourceAnalyzer();

        analyzer.Inspect(MyEventSource.Log);
    }