private void Configure(Action <IAppBuilder> startup, StartOptions options = null) { if (startup == null) { throw new ArgumentNullException("startup"); } options = options ?? new StartOptions(); if (string.IsNullOrWhiteSpace(options.AppStartup)) { // Populate AppStartup for use in host.AppName options.AppStartup = startup.Method.ReflectedType.FullName; } var testServerFactory = new OwinEmbeddedServerFactory(); IServiceProvider services = ServicesFactory.Create( serviceProvider => serviceProvider.AddInstance <ITraceOutputFactory>(new NullTraceOutputFactory()) ); var engine = services.GetService <IHostingEngine>(); var context = new StartContext(options) { ServerFactory = new ServerFactoryAdapter(testServerFactory), Startup = startup }; _started = engine.Start(context); _next = testServerFactory.Invoke; }
private void Configure(Action<IAppBuilder> startup, StartOptions options = null) { if (startup == null) { throw new ArgumentNullException("startup"); } options = options ?? new StartOptions(); if (string.IsNullOrWhiteSpace(options.AppStartup)) { // Populate AppStartup for use in host.AppName options.AppStartup = startup.Method.ReflectedType.FullName; } var testServerFactory = new OwinEmbeddedServerFactory(); IServiceProvider services = ServicesFactory.Create(); var engine = services.GetService<IHostingEngine>(); var context = new StartContext(options) { ServerFactory = new ServerFactoryAdapter(testServerFactory), Startup = startup }; _started = engine.Start(context); _next = testServerFactory.Invoke; }