Beispiel #1
0
        public void RemoveAll_Should_Remove_SiteCache_Keys_Only()
        {
            // Arrange
            CacheMock cache = new CacheMock();

            cache.Add("list.blah", "xyz", new CacheItemPolicy());
            ApplicationSettings settings  = new ApplicationSettings();
            SiteCache           siteCache = new SiteCache(settings, cache);

            siteCache.AddMenu("menu html");
            siteCache.AddLoggedInMenu("logged in menu html");
            siteCache.AddAdminMenu("admin menu html");

            TextPluginStub plugin = new TextPluginStub();

            plugin.PluginCache = siteCache;
            plugin.Repository  = new RepositoryMock();
            plugin.Settings.SetValue("foo", "bar");

            // Act
            siteCache.RemoveAll();

            // Assert
            Assert.That(cache.Count(), Is.EqualTo(1));
        }
Beispiel #2
0
        public ActionResult Clear()
        {
            _pageViewModelCache.RemoveAll();
            _listCache.RemoveAll();
            _siteCache.RemoveAll();
            TempData["CacheCleared"] = true;

            return(RedirectToAction("Index"));
        }