public void SetValueUpdatesTheCache() { CacheSettingsProvider doc = new CacheSettingsProvider(this); string testSection = "foo"; string testEntry = "bar"; getValueReturns = 42; Assert.AreEqual(42, doc.GetValue(testSection, testEntry)); doc.SetValue(testSection, testEntry, 666); Assert.AreEqual(666, doc.GetValue(testSection, testEntry)); Assert.AreEqual(1, getValueHits); Assert.AreEqual(1, setValueHits); }
public void RemoveValueRemovesFromCache() { CacheSettingsProvider doc = new CacheSettingsProvider(this); string testSection = "foo"; string testEntry = "bar"; getValueReturns = 42; doc.GetValue(testSection, testEntry); doc.RemoveEntry(testSection, testEntry); doc.GetValue(testSection, testEntry); Assert.AreEqual(2, getValueHits); Assert.AreEqual(1, removeEntryHits); }
public void GetValueTwiceUsesCache() { CacheSettingsProvider doc = new CacheSettingsProvider(this); string testSection = "foo"; string testEntry = "bar"; getValueReturns = 42; object returned = doc.GetValue(testSection, testEntry); Assert.AreEqual(this.getValueReturns, returned); doc.GetValue(testSection, testEntry); doc.GetValue(testSection, testEntry); Assert.AreEqual(1, getValueHits); }
public void PrefetchLoadsCache() { CacheSettingsProvider doc = new CacheSettingsProvider(this); object returned = doc.GetValue("1234", "5678"); //See the Prefetch thing Assert.AreEqual(42, returned); Assert.AreEqual(0, getValueHits); }
public void GetValueAsksInnerXmlDoc() { CacheSettingsProvider doc = new CacheSettingsProvider(this); string testSection = "foo"; string testEntry = "bar"; getValueReturns = 42; object returned = doc.GetValue(testSection, testEntry); Assert.AreEqual(this.getValueReturns, returned); Assert.AreEqual(testSection, section); Assert.AreEqual(testEntry, entry); Assert.AreEqual(1, getValueHits); }