예제 #1
0
        public void Configuration(IAppBuilder app)
        {
            Log.Logger = StandardLoggerConfigurator
                         .GetLoggerConfig().MinimumLevel
                         .Debug()
                         .CreateLogger();

            Log.Logger.Information("Starting...");
            Log.Logger.Information("Version is... " + ConfigurationManager.AppSettings["ReleaseNumber"]);

            // setup http configuration
            var httpConfig = new HttpConfiguration();

            //configure dependency injection
            var container = IoC.Initialize();

            container.AssertConfigurationIsValid();
            Debug.WriteLine(container.WhatDoIHave());
            Log.Logger.Debug(container.WhatDoIHave());
            httpConfig.DependencyResolver = new StructureMapWebApiDependencyResolver(container);

            JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary <string, string>();

            app.UseIdentityServerBearerTokenAuthentication(
                new IdentityServerBearerTokenAuthenticationOptions
            {
                Authority      = ConfigurationManager.AppSettings["IdentityServerApplicationUrl"],
                RequiredScopes = new[] { "gallerymanagement" }
            });

            WebApiConfig.Register(httpConfig);
            app.UseWebApi(httpConfig);

            AutoMapperInitializor.Init();
        }
예제 #2
0
        public new static CarServiceContext GivenContext()
        {
            AutoMapperInitializor.Init();

            var inMemoryDataContext = new InMemoryDataContext();
            var repository          = new Repository(inMemoryDataContext);
            var eventService        = new EventService(repository);
            var carService          = new CarService(repository);
            var fixture             = new Fixture();

            return(new CarServiceContext(fixture, repository, carService, inMemoryDataContext, eventService));
        }