protected ApiControllerTestBase(ApiTestSetup <TSession> setup)
        {
            if (setup == null)
            {
                throw new ArgumentException("Please initialise the test class by creating a constructor and passing the setup argument to base()", "setup");
            }
            _setup = setup;

            var rootScope = setup.Container.BeginLifetimeScope(setup.AdditionalConfig);

            var config = new HttpConfiguration {
                DependencyResolver = new AutofacWebApiDependencyResolver(rootScope)
            };

            setup.RegisterWebApiConfig(config);
            config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
            _httpServer = new HttpServer(config);

            Session = rootScope.Resolve <TSession>();
            if (setup.SessionSetup != null)
            {
                setup.SessionSetup(Session);
            }
        }
Ejemplo n.º 2
0
 internal ApiTestSetup(ApiTestSetup setup)
     : base(setup.Container, setup.RegisterWebApiConfig, setup.AdditionalConfig)
 {
 }
Ejemplo n.º 3
0
 protected ApiControllerTestBase(ApiTestSetup setup)
     : base(new ApiTestSetup <NoSession>(setup))
 {
 }