Exemple #1
0
        // REVIEW: we can configure services via AppStartup or via hostContext.Services
        public TestServer(IConfiguration config, IServiceProvider serviceProvider, Action<IApplicationBuilder> configureApp, ConfigureServicesDelegate configureServices)
        {
            var hostContext = new HostingContext()
            {
                ApplicationName = "Test App",
                Configuration = config,
                ServerFactory = this,
                StartupMethods = new StartupMethods(configureApp, configureServices)
            };

            _appInstance = new HostingEngine(serviceProvider).Start(hostContext);
        }
Exemple #2
0
 public static TestServer Create(IServiceProvider serviceProvider, Action<IApplicationBuilder> configureApp, ConfigureServicesDelegate configureServices)
 {
     // REVIEW: do we need an overload that takes Config for Create?
     var config = new Configuration();
     return new TestServer(config, serviceProvider, configureApp, configureServices);
 }
Exemple #3
0
 // TODO: switch to ConfigureDelegate eventually
 public StartupMethods(Action<IApplicationBuilder> configure, ConfigureServicesDelegate configureServices)
 {
     ConfigureDelegate = configure;
     ConfigureServicesDelegate = configureServices ?? ApplicationStartup.DefaultBuildServiceProvider;
 }