Beispiel #1
0
        public void Configuration(IAppBuilder app)
        {
            var config = Startup.HttpConfiguration;

            config.DependencyResolver = new UnityDependencyResolver(UnityHelpers.GetConfiguredContainer());
            ConfigureWebApi(app, config);
        }
        public async void Calling_Home_Should_Return_Objects()
        {
            var testServer = TestServer.Create <Repository.Web.Startup>();

            //We are cheating here and using the fact that unity gives back the last type registered
            UnityHelpers.GetConfiguredContainer().RegisterType <IItemRepository, TestItemRepository>();

            var response = await testServer.HttpClient.GetAsync("/home/");

            var result = await response.Content.ReadAsAsync <IList <string> >();

            Assert.AreEqual(result[0], "TestItem");
        }
        public void Configuration(IAppBuilder app)
        {
            HttpConfiguration config = new HttpConfiguration();

            config.DependencyResolver = new UnityResolver(
                UnityHelpers.GetConfiguredContainer());

            ConfigureOAuth(app);

            WebApiConfig.Register(config);
            app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);

            app.UseWebApi(config);
        }
Beispiel #4
0
        public void Configuration(IAppBuilder app)
        {
            Log.Info("Starting ClcWorld Web API");

            AppConfig.Configure();

            AutoMappingConfig.Configuration();
            var config = new HttpConfiguration
            {
                // Configuración de Unity
                DependencyResolver = new UnityHierarchicalDependencyResolver(UnityHelpers.GetConfiguredContainer())
            };

            WebApiConfig.Register(config);
            // SwaggerConfig.Register(config);

            app.UseWebApi(config);
        }
 public UnhandledExceptionLogger()
 {
     _log = UnityHelpers.GetConfiguredContainer().Resolve <ILogService>();
 }
 public AppExceptionFilter()
 {
     _log = UnityHelpers.GetConfiguredContainer().Resolve <ILogService>();
 }