Example #1
0
 public void when_inspecting_valid_eventSources()
 {
     EventSourceAnalyzer.InspectAll(MultipleTypesEventSource.Log);
     EventSourceAnalyzer.InspectAll(TestEventSource.Log);
     EventSourceAnalyzer.InspectAll(MyCompanyEventSource.Log);
     EventSourceAnalyzer.InspectAll(SemanticLoggingEventSource.Log);
 }
        public void EventSourceConsistencyTest()
        {
            var eventSource = new PrivateType("Dealogic.ServiceBus.Azure.Serialization", "Dealogic.ServiceBus.Azure.Serialization.Tracing.ServiceBusSerializationEventSource");
            var log         = (EventSource)eventSource.GetStaticProperty("Log");

            EventSourceAnalyzer.InspectAll(log);
        }
Example #3
0
 public void VerifyEventSources()
 {
     EventSourceAnalyzer.InspectAll(ExecutorEventSource.Log);
     EventSourceAnalyzer.InspectAll(ChannelEventSource.Log);
     EventSourceAnalyzer.InspectAll(BootstrapEventSource.Log);
     EventSourceAnalyzer.InspectAll(MqttEventSource.Log);
 }
Example #4
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);
        }
        public void when_inspecting_event_enum_types_that_generates_invalid_manifest()
        {
            //DifferentEnumsEventSource.Log.UsingEnumArguments(
            //    MyLongEnum.Value1, MyIntEnum.Value1, MyShortEnum.Value1
            //    );

            EventSourceAnalyzer.InspectAll(DifferentEnumsEventSource.Log);
        }
Example #6
0
        public void StandardLogEventSource_Verify()
        {
            var analyzer = new EventSourceAnalyzer
            {
                ExcludeWriteEventTypeOrder = true
            };

            analyzer.Inspect(StandardLogEventSource.Log);
        }
Example #7
0
        public void PerformanceLogEventSource_Verify()
        {
            var analyzer = new EventSourceAnalyzer
            {
                ExcludeWriteEventTypeOrder = true
            };

            analyzer.Inspect(PerformanceLogEventSource.Log);
        }
Example #8
0
        public void BlueprintEventSource_Verify()
        {
            var analyzer = new EventSourceAnalyzer
            {
                ExcludeWriteEventTypeOrder = true
            };

            analyzer.Inspect(BlueprintEventSource.Log);
        }
Example #9
0
        public void Analyze()
        {
            // arrange
            EventSourceAnalyzer analyzer = new EventSourceAnalyzer();

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

            // assert
            Assert.False(report.HasErrors);
        }
        public void Inspect()
        {
            // arrange
            EventSourceAnalyzer analyzer = new EventSourceAnalyzer();

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

            // assert
            Assert.False(report.HasErrors);
        }
Example #11
0
        public void Inspect_HotChocolateActivityEventSource()
        {
            // arrange
            var analyzer = new EventSourceAnalyzer();

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

            // assert
            Assert.False(report.HasErrors);
        }
Example #12
0
 static void VerifyEventSource()
 {
     try
     {
         EventSourceAnalyzer.InspectAll(MyCompanyEventSource.Log);
         Console.WriteLine("No incompatibilities found in MyCompanyEventSource");
     }
     catch (EventSourceAnalyzerException e)
     {
         Console.WriteLine("Incompatibilities found in MyCompanyEventSource");
         Console.WriteLine(e.Message);
     }
 }
Example #13
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 static void Call_from_tests_check_eventsources(Assembly actorOrServiceAssembly)
 {
     foreach (var eventSourceType in actorOrServiceAssembly.GetTypes().Where(type => type.IsSubclassOf(typeof(EventSource))))
     {
         var eventSource = GetEventSourceAccessor(eventSourceType, "Current") ?? GetEventSourceAccessor(eventSourceType, "Log");
         if (eventSource == null)
         {
             throw new NotImplementedException($"Expected EventSource {eventSourceType.Name} to expose a static accessor named 'Current' or 'Log'");
         }
         EventSourceAnalyzer.InspectAll(eventSource);
     }
     foreach (var eventSourceType in actorOrServiceAssembly.GetTypes().Where(type => type.IsSubclassOf(typeof(Microsoft.Diagnostics.Tracing.EventSource))))
     {
         var eventSource = GetEventSourceAccessor(eventSourceType, "Current") ?? GetEventSourceAccessor(eventSourceType, "Log");
         if (eventSource == null)
         {
             throw new NotImplementedException($"Expected EventSource {eventSourceType.Name} to expose a static accessor named 'Current' or 'Log'");
         }
         EventSourceAnalyzer.InspectAll(eventSource);
     }
 }
 public void Validate_Etw_Manifest()
 {
     EventSourceAnalyzer.InspectAll(DeviceSimulator.DeviceSimulatorActorEventSource.Current);
 }
Example #16
0
 public void CustomEventSourcePassesValidation()
 {
     EventSourceAnalyzer.InspectAll(ColdStorageEventSource.Log);
 }
Example #17
0
 public void TestTestRunnerEventSource()
 {
     EventSourceAnalyzer.InspectAll(TestRunnerEventSource.Log);
 }
Example #18
0
 public void TestStorageBackupUploaderEventSource()
 {
     EventSourceAnalyzer.InspectAll(BackupUploaderEventSource.Log);
 }
Example #19
0
 public void TestSuggestionWatcherEventSource()
 {
     EventSourceAnalyzer.InspectAll(SuggestionWatcherEventSource.Log);
 }
Example #20
0
 public void TestHltbScraperEventSource()
 {
     EventSourceAnalyzer.InspectAll(HltbScraperEventSource.Log);
 }
Example #21
0
 public void ShouldValidateEventSource()
 {
     EventSourceAnalyzer.InspectAll(AuditEventSource.Log);
 }
 public void CustomEventSourcePassesValidation()
 {
     EventSourceAnalyzer.InspectAll(ScenarioSimulatorEventSource.Log);
 }
 public void VerifyEventSources()
 {
     EventSourceAnalyzer.InspectAll(CommonEventSource.Log);
     EventSourceAnalyzer.InspectAll(BootstrapperEventSource.Log);
 }
Example #24
0
 public void TestCommonEventSource()
 {
     EventSourceAnalyzer.InspectAll(CommonEventSource.Log);
 }
Example #25
0
 public void ValidateEventSource()
 {
     EventSourceAnalyzer.InspectAll(AnalyticsEventSource.Log);
 }
Example #26
0
 public void TestSiteEventSource()
 {
     EventSourceAnalyzer.InspectAll(SiteEventSource.Log);
 }
 public void ShouldValidateEventSource()
 {
     EventSourceAnalyzer.InspectAll(SemanticLoggingEventSource.Log);
 }
Example #28
0
 public void TestMissingUpdaterEventSource()
 {
     EventSourceAnalyzer.InspectAll(MissingUpdaterEventSource.Log);
 }
 public void ValidateEventSource()
 {
     //// see https://msdn.microsoft.com/en-us/library/dn774985(v=pandp.20).aspx
     //// for details about the EventSourceAnalyzer, its coverage and validation checks
     EventSourceAnalyzer.InspectAll(Logger.Log);
 }
Example #30
0
 public void TestUnknownUpdaterEventSource()
 {
     EventSourceAnalyzer.InspectAll(UnknownUpdaterEventSource.Log);
 }