public void addmenu_should_cache_html() { // Arrange CacheMock cache = new CacheMock(); SiteCache siteCache = new SiteCache(cache); // Act siteCache.AddMenu("some html"); // Assert Assert.That(cache.Count(), Is.EqualTo(1)); IEnumerable<string> keys = cache.Select(x => x.Key); Assert.That(keys, Contains.Item(CacheKeys.MenuKey())); }
public void AddMenu_Should_Cache_Html() { // Arrange CacheMock cache = new CacheMock(); ApplicationSettings settings = new ApplicationSettings(); SiteCache siteCache = new SiteCache(settings, cache); // Act siteCache.AddMenu("some html"); // Assert Assert.That(cache.Count(), Is.EqualTo(1)); IEnumerable<string> keys = cache.Select(x => x.Key); Assert.That(keys, Contains.Item(CacheKeys.MenuKey())); }
public void getmenu_should_return_correct_html() { // Arrange string expectedHtml = "some html"; CacheMock cache = new CacheMock(); SiteCache siteCache = new SiteCache(cache); siteCache.AddMenu(expectedHtml); // Act string actualHtml = siteCache.GetMenu(); // Assert Assert.That(actualHtml, Is.EqualTo(expectedHtml)); }
public void GetMenu_Should_Return_Correct_Html() { // Arrange string expectedHtml = "some html"; CacheMock cache = new CacheMock(); ApplicationSettings settings = new ApplicationSettings(); SiteCache siteCache = new SiteCache(settings, cache); siteCache.AddMenu(expectedHtml); // Act string actualHtml = siteCache.GetMenu(); // Assert Assert.That(actualHtml, Is.EqualTo(expectedHtml)); }
public void RemoveMenuCacheItems_Should_Clear_Cache_Items() { // Arrange CacheMock cache = new CacheMock(); ApplicationSettings settings = new ApplicationSettings() { UseObjectCache = true }; SiteCache siteCache = new SiteCache(settings, cache); siteCache.AddMenu("menu html"); siteCache.AddLoggedInMenu("logged in menu html"); siteCache.AddAdminMenu("admin menu html"); // Act siteCache.RemoveMenuCacheItems(); // Assert Assert.That(cache.Count(), Is.EqualTo(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)); }
public void removemenucacheitems_should_clear_cache_items() { // Arrange CacheMock cache = new CacheMock(); SiteCache siteCache = new SiteCache(cache); siteCache.AddMenu("menu html"); siteCache.AddLoggedInMenu("logged in menu html"); siteCache.AddAdminMenu("admin menu html"); // Act siteCache.RemoveMenuCacheItems(); // Assert Assert.That(cache.Count(), Is.EqualTo(0)); }