protected void ApplicationStartupForTests(TinyIoCContainer container, IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);
            pipelines.OnError.AddItemToEndOfPipeline(
                (ctx, ex) => new OnErrorHooks(_logger)
                .HandleInternalServerError(
                    ctx,
                    ex,
                    container.Resolve <IResponseNegotiator>(),
                    _env));

            pipelines.AfterRequest += ctx =>
            {
                foreach (var corsHeader in HttpResponseHeaders.CorsHeaders)
                {
                    ctx.Response.Headers.Add(corsHeader.Item1, corsHeader.Item2);
                }
            };

            //container registrations
            container.Register(_appConfig);
            container.Register(_logger);
            container.Register <NancyContextWrapper>();
            container.RegisterServices();
            container.RegisterInMemoryStores();
        }
        protected override void ConfigureRequestContainer(TinyIoCContainer container, NancyContext context)
        {
            base.ConfigureRequestContainer(container, context);
            container.Register(new NancyContextWrapper(context));
            var appConfig = container.Resolve <IAppConfiguration>();

            container.UseHttpClientFactory(context, appConfig.IdentityServerConfidentialClientSettings);
            container.RegisterServices();

            var configurator = container.Resolve <IPersistenceConfigurator>();

            configurator.ConfigureRequestInstances(container);
        }
        protected override void ConfigureRequestContainer(TinyIoCContainer container, NancyContext context)
        {
            base.ConfigureRequestContainer(container, context);
            container.Register(new NancyContextWrapper(context));
            var appConfig = container.Resolve <IAppConfiguration>();

            container.UseHttpClientFactory(context, appConfig.IdentityServerConfidentialClientSettings);
            container.RegisterServices();
            if (!_appConfig.UseInMemoryStores)
            {
                container.RegisterCouchDbStores(_appConfig, _loggingLevelSwitch);
            }
        }