public void WebBootHttpRuntimeCache() { //// Arrange var container = new ServiceContainer(); var loader = new WebBoot(container); //// Act loader.Boot(); //// Assert Assert.That(Active.CacheManager, Is.Not.Null); Assert.That(Active.CacheManager.RuntimeCache, Is.Not.Null); Assert.That(Active.CacheManager.RuntimeCache.GetType(), Is.EqualTo(typeof(HttpRuntimeCacheProvider))); }
/// <summary> /// Handles the Application Start. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The <see cref="EventArgs"/>. /// </param> private void Application_Start(object sender, EventArgs e) { // Code that runs on application startup AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); RouteConfig.RegisterRoutes(RouteTable.Routes); // Instantiate the Service Container var container = new ServiceContainer(); container.EnableAnnotatedConstructorInjection(); container.EnableAnnotatedPropertyInjection(); // Bootstrap! var loader = new WebBoot(container); loader.Boot(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { WebBoot.RegisterServices(services, Configuration); var appSettings = Configuration.GetSection("AppSettings"); services.Configure <AppSettings>(appSettings); var userImageSettings = Configuration.GetSection("UserProfileImage"); services.Configure <UserProfileImageSettings>(userImageSettings); var reputationSettings = Configuration.GetSection("ReputationSettings"); services.Configure <ReputationSettings>(reputationSettings); var guestPolicy = new AuthorizationPolicyBuilder() .RequireAuthenticatedUser() .RequireClaim("scope", "fso.Api") .Build(); services.AddCors(options => { options.AddPolicy("CorsPolicy", builder => builder .WithOrigins( "http://192.168.1.67:10575", "https://192.168.1.67:10575", "http://*****:*****@"rabbitmq", Port = 5672 } }; connection.ConnectIntervalAttempt = TimeSpan.FromSeconds(4); connection.RequestedHeartbeat = 4; connection.Timeout = 20; var _bus = RabbitHutch.CreateBus(connection, ser => ser.Register <IEasyNetQLogger>(logger => new DoNothingLogger())); // event bus Console.WriteLine("Bus connected {0}", _bus.IsConnected); services.AddSingleton(_bus); services.AddMvc(options => { //options.Filters.Add(new AuthorizeFilter(guestPolicy)); }).AddJsonOptions(options => { options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; }); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Version = "v1", Title = "feasion API", Description = "feasion Web API Doc", TermsOfService = "None", Contact = new Contact { Name = "Okan Aslankan", Email = "*****@*****.**", Url = "https://www.facebook.com/DooooooMachinE" }, License = new License { Name = "Some licence with law.", Url = "https://www.facebook.com/DooooooMachinE" } }); }); services.AddAutoMapper(); }