Here are the examples of the csharp api class Microsoft.ApplicationInsights.EtwTelemetryCollector.Tests.EtwTelemetryModuleTests.GetTestTelemetryConfiguration(bool) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
15 Examples
0
1. Example
Project: ApplicationInsights-dotnet-logging
Source File: EtwTelemetryModuleTests.cs
Source File: EtwTelemetryModuleTests.cs
[TestMethod] [TestCategory("EtwTelemetryModule")] public void InitializeFailedWhenDisposed() { using (EventSourceModuleDiagnosticListener listener = new EventSourceModuleDiagnosticListener()) { EtwTelemetryModule module = new EtwTelemetryModule(); module.Dispose(); module.Initialize(GetTestTelemetryConfiguration()); Assert.AreEqual(1, listener.EventsReceived.Count); Assert.AreEqual(ModuleInitializationFailedEventId, listener.EventsReceived[0].EventId); Assert.AreEqual("Can't initialize a module that is disposed. The initialization is terminated.", listener.EventsReceived[0].Payload[1].ToString()); } }
0
2. Example
Project: ApplicationInsights-dotnet-logging
Source File: EtwTelemetryModuleTests.cs
Source File: EtwTelemetryModuleTests.cs
[TestMethod] [TestCategory("EtwTelemetryModule")] public void InitializeFailedWhenSourceIsNotSpecified() { using (EventSourceModuleDiagnosticListener listener = new EventSourceModuleDiagnosticListener()) using (TraceEventSessionMock traceEventSession = new TraceEventSessionMock(false)) using (EtwTelemetryModule module = new EtwTelemetryModule(() => traceEventSession)) { module.Initialize(GetTestTelemetryConfiguration()); Assert.AreEqual(1, listener.EventsReceived.Count); Assert.AreEqual(NoEventSourcesConfiguredEventId, listener.EventsReceived[0].EventId); Assert.AreEqual("EtwTelemetryModule", listener.EventsReceived[0].Payload[1].ToString()); } }
0
3. Example
Project: ApplicationInsights-dotnet-logging
Source File: EtwTelemetryModuleTests.cs
Source File: EtwTelemetryModuleTests.cs
[TestMethod] [TestCategory("EtwTelemetryModule")] public void InitializeFailedWhenAccessDenied() { using (EventSourceModuleDiagnosticListener listener = new EventSourceModuleDiagnosticListener()) using (TraceEventSessionMock traceEventSession = new TraceEventSessionMock(true)) using (EtwTelemetryModule module = new EtwTelemetryModule(() => traceEventSession)) { module.Sources.Add(new EtwListeningRequest() { ProviderName = "Test Provider", Level = Diagnostics.Tracing.TraceEventLevel.Always }); module.Initialize(GetTestTelemetryConfiguration()); // There will be 2 events because we also enable TPL EventSource to get hierarchical activity IDs. Assert.AreEqual(2, listener.EventsReceived.Count); Assert.AreEqual(AccessDeniedEventId, listener.EventsReceived[0].EventId); Assert.AreEqual("Access Denied.", listener.EventsReceived[0].Payload[1].ToString()); } }
0
4. Example
Project: ApplicationInsights-dotnet-logging
Source File: EtwTelemetryModuleTests.cs
Source File: EtwTelemetryModuleTests.cs
[TestMethod] [TestCategory("EtwTelemetryModule")] public void InitializeSucceed() { using (EventSourceModuleDiagnosticListener listener = new EventSourceModuleDiagnosticListener()) using (TraceEventSessionMock traceEventSession = new TraceEventSessionMock(false)) using (EtwTelemetryModule module = new EtwTelemetryModule(() => traceEventSession)) { module.Sources.Add(new EtwListeningRequest() { ProviderName = "Test Provider", Level = Diagnostics.Tracing.TraceEventLevel.Always }); module.Initialize(GetTestTelemetryConfiguration()); Assert.AreEqual(0, listener.EventsReceived.Count); } }
0
5. Example
Project: ApplicationInsights-dotnet-logging
Source File: EtwTelemetryModuleTests.cs
Source File: EtwTelemetryModuleTests.cs
[TestMethod] [TestCategory("EtwTelemetryModule")] public void ProviderEnabledByName() { using (EventSourceModuleDiagnosticListener listener = new EventSourceModuleDiagnosticListener()) using (TraceEventSessionMock traceEventSession = new TraceEventSessionMock(false)) using (EtwTelemetryModule module = new EtwTelemetryModule(() => traceEventSession)) { module.Sources.Add(new EtwListeningRequest() { ProviderName = "Test Provider", Level = Diagnostics.Tracing.TraceEventLevel.Always }); module.Initialize(GetTestTelemetryConfiguration()); Assert.AreEqual(1, traceEventSession.EnabledProviderNames.Count); Assert.AreEqual("Test Provider", traceEventSession.EnabledProviderNames[0]); } }
0
6. Example
Project: ApplicationInsights-dotnet-logging
Source File: EtwTelemetryModuleTests.cs
Source File: EtwTelemetryModuleTests.cs
[TestMethod] [TestCategory("EtwTelemetryModule")] public void ProviderEnabledByGuid() { using (EventSourceModuleDiagnosticListener listener = new EventSourceModuleDiagnosticListener()) using (TraceEventSessionMock traceEventSession = new TraceEventSessionMock(false)) using (EtwTelemetryModule module = new EtwTelemetryModule(() => traceEventSession)) { Guid guid = Guid.NewGuid(); module.Sources.Add(new EtwListeningRequest() { ProviderGuid = guid, Level = Diagnostics.Tracing.TraceEventLevel.Always }); module.Initialize(GetTestTelemetryConfiguration()); Assert.AreEqual(2, traceEventSession.EnabledProviderGuids.Count); // First enabled provider is the TPL provider Assert.AreEqual(guid.ToString(), traceEventSession.EnabledProviderGuids[1].ToString()); } }
0
7. Example
Project: ApplicationInsights-dotnet-logging
Source File: EtwTelemetryModuleTests.cs
Source File: EtwTelemetryModuleTests.cs
[TestMethod] [TestCategory("EtwTelemetryModule")] public void ProviderNotEnabledByEmptyGuid() { using (EventSourceModuleDiagnosticListener listener = new EventSourceModuleDiagnosticListener()) using (TraceEventSessionMock traceEventSession = new TraceEventSessionMock(false)) using (EtwTelemetryModule module = new EtwTelemetryModule(() => traceEventSession)) { Guid guid = Guid.Empty; module.Sources.Add(new EtwListeningRequest() { ProviderGuid = guid, Level = Diagnostics.Tracing.TraceEventLevel.Always }); module.Initialize(GetTestTelemetryConfiguration()); Assert.IsFalse(traceEventSession.EnabledProviderGuids.Any(g => Guid.Empty.Equals(g))); } }
0
8. Example
Project: ApplicationInsights-dotnet-logging
Source File: EtwTelemetryModuleTests.cs
Source File: EtwTelemetryModuleTests.cs
[TestMethod] [TestCategory("EtwTelemetryModule")] public async Task ReportSingleEvent() { using (EtwTelemetryModule module = new EtwTelemetryModule()) { module.Sources.Add(new EtwListeningRequest() { ProviderName = TestProvider.ProviderName }); module.Initialize(GetTestTelemetryConfiguration()); TestProvider.Log.Info("Hello!"); int expectedEventCount = 2; await WaitForItems(adapterHelper.Channel, expectedEventCount); // The very 1st event is for the manifest. Assert.AreEqual(expectedEventCount, this.adapterHelper.Channel.SentItems.Length); TraceTelemetry telemetry = (TraceTelemetry)this.adapterHelper.Channel.SentItems[1]; Assert.AreEqual("Hello!", telemetry.Message); } }
0
9. Example
Project: ApplicationInsights-dotnet-logging
Source File: EtwTelemetryModuleTests.cs
Source File: EtwTelemetryModuleTests.cs
[TestMethod] [TestCategory("EtwTelemetryModule")] public async Task ReportMultipleEvents() { using (EtwTelemetryModule module = new EtwTelemetryModule()) { module.Sources.Add(new EtwListeningRequest() { ProviderName = TestProvider.ProviderName }); module.Initialize(GetTestTelemetryConfiguration()); TestProvider.Log.Info("Hello!"); TestProvider.Log.Info("World!"); int expectedEventCount = 3; await WaitForItems(adapterHelper.Channel, expectedEventCount); // The very 1st event is for the manifest. Assert.AreEqual(expectedEventCount, this.adapterHelper.Channel.SentItems.Length); TraceTelemetry hello = (TraceTelemetry)this.adapterHelper.Channel.SentItems[1]; TraceTelemetry world = (TraceTelemetry)this.adapterHelper.Channel.SentItems[2]; Assert.AreEqual("Hello!", hello.Message); Assert.AreEqual("World!", world.Message); } }
0
10. Example
Project: ApplicationInsights-dotnet-logging
Source File: EtwTelemetryModuleTests.cs
Source File: EtwTelemetryModuleTests.cs
[TestMethod] [TestCategory("EtwTelemetryModule")] public async Task ReportsAllProper/n ..... /n //View Source file for more details /n }
0
11. Example
Project: ApplicationInsights-dotnet-logging
Source File: EtwTelemetryModuleTests.cs
Source File: EtwTelemetryModuleTests.cs
[TestMethod] [TestCategory("EtwTelemetryModule")] public async Task ReportSeverityLevel() { //bool isCalled = false; // using (TestProvider provider = new TestProvider()) using (EtwTelemetryModule module = new EtwTelemetryModule()) { module.Sources.Add(new EtwListeningRequest() { ProviderName = TestProvider.ProviderName }); module.Initialize(GetTestTelemetryConfiguration()); TestProvider.Log.Info("Hello!"); TestProvider.Log.Warning(1, 2); int expectedEventCount = 3; await this.WaitForItems(this.adapterHelper.Channel, expectedEventCount); // The very 1st event is for the manifest. Assert.AreEqual(expectedEventCount, this.adapterHelper.Channel.SentItems.Length); Assert.AreEqual(SeverityLevel.Information, ((TraceTelemetry)this.adapterHelper.Channel.SentItems[1]).SeverityLevel); Assert.AreEqual(SeverityLevel.Warning, ((TraceTelemetry)this.adapterHelper.Channel.SentItems[2]).SeverityLevel); } }
0
12. Example
Project: ApplicationInsights-dotnet-logging
Source File: EtwTelemetryModuleTests.cs
Source File: EtwTelemetryModuleTests.cs
[TestMethod] [TestCategory("EtwTelemetryModule")] public async Task HandlesDuplicate/n ..... /n //View Source file for more details /n }
0
13. Example
Project: ApplicationInsights-dotnet-logging
Source File: EtwTelemetryModuleTests.cs
Source File: EtwTelemetryModuleTests.cs
[TestMethod] [TestCategory("EtwTelemetryModule")] public async Task ReactsToConfigur/n ..... /n //View Source file for more details /n }
0
14. Example
Project: ApplicationInsights-dotnet-logging
Source File: EtwTelemetryModuleTests.cs
Source File: EtwTelemetryModuleTests.cs
[TestMethod] [TestCategory("EtwTelemetryModule")] public async Task DoNotReportTplEvents() { using (var module = new EtwTelemetryModule()) { module.Initialize(GetTestTelemetryConfiguration()); for (int i = 0; i < 10; i += 2) { Parallel.For(0, 2, (idx) => { PerformActivityAsync(i + idx).GetAwaiter().GetResult(); }); } // Wait 2 seconds to see if any events arrive asynchronously through the ETW module. // This is a long time but unfortunately there is no good way to make ETW infrastructure "go faster" // and we want to make sure that no TPL events sneak through. await this.WaitForItems(this.adapterHelper.Channel, 1, TimeSpan.FromSeconds(2)); Assert.AreEqual(0, this.adapterHelper.Channel.SentItems.Length); } }
0
15. Example
Project: ApplicationInsights-dotnet-logging
Source File: EtwTelemetryModuleTests.cs
Source File: EtwTelemetryModuleTests.cs
[TestMethod] [TestCategory("EtwTelemetryModule")] public async Task ReportsHierarchi/n ..... /n //View Source file for more details /n }