public void ListSingleCache_InvalidCacheName() { var cmd = new Cmd.Cache(); InitCommand(cmd); cmd.CacheName = "nonexisting cache"; var result = cmd.Run(); Assert.That(result.Status, Is.EqualTo(CommandStatus.Failure)); }
public void ListAll() { var cmd = new Cmd.Cache(); InitCommand(cmd); var result = cmd.Run(); Assert.That(result.Status, Is.EqualTo(CommandStatus.Success)); // Make sure several of the caches appear Assert.That(result.Message, Is.StringContaining("AccessResultCache")); Assert.That(result.Message, Is.StringContaining("web[standardValues]")); }
public void ListSingleCache() { var testCache = new TestCache(); testCache.InnerCache.Add("lorem", "ipsum"); var cmd = new Cmd.Cache(); InitCommand(cmd); cmd.CacheName = CACHE_NAME; var result = cmd.Run(); Assert.That(result.Status, Is.EqualTo(CommandStatus.Success)); Assert.That(result.Message, Is.StringContaining("lorem")); }
public void GetEntriesPartial() { var testCache = new TestCache(); testCache.InnerCache.Add("lorem1", "ipsum1"); testCache.InnerCache.Add("lorem2", "ipsum2"); testCache.InnerCache.Add("dolor", "sit"); var cmd = new Cmd.Cache(); InitCommand(cmd); cmd.CacheName = CACHE_NAME; cmd.KeyName = "lorem"; cmd.KeyNamePartial = true; var result = cmd.Run(); Assert.That(result.Status, Is.EqualTo(CommandStatus.Success)); Assert.That(result.Message, Is.StringContaining("lorem1")); Assert.That(result.Message, Is.StringContaining("ipsum1")); Assert.That(result.Message, Is.StringContaining("lorem2")); Assert.That(result.Message, Is.StringContaining("ipsum2")); }
public void ClearAll() { var cmd = new Cmd.Cache(); InitCommand(cmd); cmd.Clear = true; var result = cmd.Run(); Assert.That(result.Status, Is.EqualTo(CommandStatus.Success)); var cache = CacheManager.GetHtmlCache(Sitecore.Context.Site); Assert.That(cache.InnerCache.Size, Is.EqualTo(0)); }
public void ClearSingelEntry() { var testCache = new TestCache(); testCache.InnerCache.Add("lorem", "ipsum"); testCache.InnerCache.Add("dolor", "sit"); var cmd = new Cmd.Cache(); InitCommand(cmd); cmd.CacheName = CACHE_NAME; cmd.KeyName = "dolor"; cmd.Clear = true; var result = cmd.Run(); Assert.That(result.Status, Is.EqualTo(CommandStatus.Success)); Assert.That(testCache.InnerCache["dolor"], Is.Null); Assert.That(testCache.InnerCache["lorem"], Is.EqualTo("ipsum")); }