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 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)); }