public void RecognizeNumericPriorityValues() { const string xmlSimple = "<syscache><cache region='foo' expiration='500' priority='0' /></syscache>"; var handler = new MemoryCacheSectionHandler(); XmlNode section = GetConfigurationSection(xmlSimple); MemoryCache[] cache = CreateCache((CacheConfig[])handler.Create(null, null, section)); Assert.That(cache[0].Priority, Is.EqualTo(CacheItemPriority.Default)); }
public void TestGetConfigFromFile() { const string xmlSimple = "<memorycache><cache region=\"foo\" expiration=\"500\" priority=\"0\" /></memorycache>"; var handler = new MemoryCacheSectionHandler(); XmlNode section = GetConfigurationSection(xmlSimple); object result = handler.Create(null, null, section); Assert.IsNotNull(result); Assert.IsTrue(result is CacheConfig[]); var caches = result as CacheConfig[]; Assert.AreEqual(1, caches.Length); }
public void TestGetConfigNullSection() { var handler = new MemoryCacheSectionHandler(); var section = new XmlDocument(); object result = handler.Create(null, null, section); Assert.IsNotNull(result); Assert.IsTrue(result is CacheConfig[]); var caches = result as CacheConfig[]; Assert.AreEqual(0, caches.Length); }