public void SdkVersionIsPopulatedByMiddleware() { var middleware = new HostingDiagnosticListener(CommonMocks.MockTelemetryClient(telemetry => this.sentTelemetry = telemetry), CommonMocks.MockCorrelationIdLookupHelper()); middleware.OnHostingException(null, null); Assert.NotEmpty(sentTelemetry.Context.GetInternalContext().SdkVersion); Assert.Contains(SdkVersionTestUtils.VersionPrefix, sentTelemetry.Context.GetInternalContext().SdkVersion); }
public void InvokeTracksExceptionThrownByNextMiddlewareAsHandledByPlatform() { var middleware = new HostingDiagnosticListener(CommonMocks.MockTelemetryClient(telemetry => this.sentTelemetry = telemetry), CommonMocks.MockCorrelationIdLookupHelper()); middleware.OnHostingException(null, null); Assert.NotNull(sentTelemetry); Assert.IsType <ExceptionTelemetry>(sentTelemetry); Assert.Equal(ExceptionHandledAt.Platform, ((ExceptionTelemetry)sentTelemetry).HandledAt); }
private static OperationCorrelationTelemetryInitializer CreateInitializer(IHttpContextAccessor contextAccessor) { return(new OperationCorrelationTelemetryInitializer(contextAccessor, CommonMocks.MockCorrelationIdLookupHelper())); }
public RequestTrackingMiddlewareTest() { this.middleware = new HostingDiagnosticListener(CommonMocks.MockTelemetryClient(telemetry => this.sentTelemetry.Add(telemetry)), CommonMocks.MockCorrelationIdLookupHelper()); }