Пример #1
0
        public void Configuration(IAppBuilder app)
        {
            var httpConfiguration = new HttpConfiguration();

            httpConfiguration.MapHttpAttributeRoutes();
            httpConfiguration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;

            // To ensure that test calls from browsers get json by default. XML is still supported by setting
            // Content-Type: application/xml
            httpConfiguration.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));

            app.UseWebApi(httpConfiguration);

            var resolver = new UnityDependencyResolver(new UnityContainer());

            httpConfiguration.DependencyResolver = resolver;

            //add any middleware with app.Use()
            SwaggerConfig.Register(httpConfiguration);
            httpConfiguration.EnsureInitialized();

            var cacheUtil = new CacheControllerUtil();

            cacheUtil.RegisterAllCaches();

            InitDb(DbPath);
        }
        public void TestNotRegisteredCacheNames()
        {
            var ccu = new CacheControllerUtil();
            var registeredCacheNames = ccu.GetRegisteredCacheNames().ToList();

            Assert.AreEqual(0, registeredCacheNames.Count);
        }
        public void TestRegisteredCacheNames()
        {
            var cacheNames           = CacheManager.GetCacheNames().ToList();
            var ccu                  = new CacheControllerUtil();
            var registeredCacheNames = ccu.GetRegisteredCacheNames().ToList();

            Assert.AreEqual(cacheNames.Count, registeredCacheNames.Count);
            Assert.IsTrue(registeredCacheNames.All(rcn => cacheNames.Contains(rcn)));
        }
Пример #4
0
 public SimpleCacheController()
 {
     this.Util = new CacheControllerUtil();
 }