コード例 #1
0
        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);
            }
        }
コード例 #2
0
 internal ApiTestSetup(ApiTestSetup setup)
     : base(setup.Container, setup.RegisterWebApiConfig, setup.AdditionalConfig)
 {
 }
コード例 #3
0
 protected ApiControllerTestBase(ApiTestSetup setup)
     : base(new ApiTestSetup <NoSession>(setup))
 {
 }