public async Task RequestWillBeMarkedAsFailedForRunawayException()
        {
            var context = new DefaultHttpContext();
            context.Request.Scheme = HttpRequestScheme;
            context.Request.Host = this.httpRequestHost;

            var requestMiddleware = new RequestTrackingMiddleware(
                httpContext => { throw new InvalidOperationException(); },
                CommonMocks.MockTelemetryClient(telemetry => this.sentTelemetry = telemetry));


            await Assert.ThrowsAsync<InvalidOperationException>(async () => { await requestMiddleware.Invoke(context, new RequestTelemetry()); } );

            Assert.False(((RequestTelemetry)this.sentTelemetry).Success);
        }
예제 #2
0
        public async Task RequestWillBeMarkedAsFailedForRunawayException()
        {
            var context = new DefaultHttpContext();

            context.Request.Scheme = HttpRequestScheme;
            context.Request.Host   = this.httpRequestHost;

            var requestMiddleware = new RequestTrackingMiddleware(
                httpContext => { throw new InvalidOperationException(); },
                CommonMocks.MockTelemetryClient(telemetry => this.sentTelemetry = telemetry));


            await Assert.ThrowsAsync <InvalidOperationException>(async() => { await requestMiddleware.Invoke(context, new RequestTelemetry()); });

            Assert.False(((RequestTelemetry)this.sentTelemetry).Success);
        }
 public RequestTrackingMiddlewareTest()
 {
     this.middleware = new RequestTrackingMiddleware(
         this.nextMiddleware,
         CommonMocks.MockTelemetryClient(telemetry => this.sentTelemetry = telemetry));
 }
예제 #4
0
 public RequestTrackingMiddlewareTest()
 {
     this.middleware = new RequestTrackingMiddleware(
         this.nextMiddleware,
         CommonMocks.MockTelemetryClient(telemetry => this.sentTelemetry = telemetry));
 }