public void CutCache() { ICacheProviderV30 prov = GetProvider(); PageInfo p1 = new PageInfo("Page1", MockPagesProvider(), DateTime.Now); PageInfo p2 = new PageInfo("Page2", MockPagesProvider(), DateTime.Now); PageInfo p3 = new PageInfo("Page3", MockPagesProvider(), DateTime.Now); PageContent c1 = new PageContent(p1, "Page 1", "admin", DateTime.Now, "Comment", "Content", null, null); PageContent c2 = new PageContent(p2, "Page 2", "user", DateTime.Now, "", "Blah", null, null); PageContent c3 = new PageContent(p3, "Page 3", "admin", DateTime.Now, "", "Content", null, null); Assert.AreEqual(0, prov.PageCacheUsage, "Wrong cache usage"); prov.SetPageContent(p1, c1); prov.SetPageContent(p2, c2); prov.SetPageContent(p3, c3); prov.SetFormattedPageContent(p1, "Content 1"); prov.SetFormattedPageContent(p3, "Content 2"); prov.GetPageContent(p3); Assert.AreEqual(3, prov.PageCacheUsage, "Wrong cache usage"); prov.CutCache(2); Assert.AreEqual(1, prov.PageCacheUsage, "Wrong cache usage"); Assert.IsNotNull(prov.GetPageContent(p3), "GetPageContent should not return null"); Assert.IsNull(prov.GetPageContent(p2), "GetPageContent should not null"); Assert.IsNull(prov.GetPageContent(p1), "GetPageContent should not null"); Assert.IsNotNull(prov.GetFormattedPageContent(p3), "GetFormattedPageContent should not return null"); Assert.IsNull(prov.GetFormattedPageContent(p2), "GetFormattedPageContent should not null"); Assert.IsNull(prov.GetFormattedPageContent(p1), "GetFormattedPageContent should not null"); }
public void CutCache_InvalidSize(int s) { ICacheProviderV30 prov = GetProvider(); prov.CutCache(s); }
public void CutCache_InvalidSize(int s) { ICacheProviderV30 prov = GetProvider(); Assert.Throws <ArgumentOutOfRangeException>(() => prov.CutCache(s)); }