public static async Task <TestHandler> Create(string scheme) { var handler = new TestHandler(); var context = new DefaultHttpContext(); context.Features.Set <IHttpResponseFeature>(new TestResponse()); await handler.InitializeAsync(new TestOptions(), context, new LoggerFactory().CreateLogger("TestHandler"), Framework.WebEncoders.UrlEncoder.Default); handler.Options.AuthenticationScheme = scheme; return(handler); }