Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
 private static OperationCorrelationTelemetryInitializer CreateInitializer(IHttpContextAccessor contextAccessor)
 {
     return(new OperationCorrelationTelemetryInitializer(contextAccessor, CommonMocks.MockCorrelationIdLookupHelper()));
 }
Example #4
0
 public RequestTrackingMiddlewareTest()
 {
     this.middleware = new HostingDiagnosticListener(CommonMocks.MockTelemetryClient(telemetry => this.sentTelemetry.Add(telemetry)),
                                                     CommonMocks.MockCorrelationIdLookupHelper());
 }