public void RecognizeNumericPriorityValues()
        {
            const string xmlSimple = "<syscache><cache region='foo' expiration='500' priority='4' /></syscache>";

            var handler = new SysCacheSectionHandler();
            XmlNode section = GetConfigurationSection(xmlSimple);
            SysCache[] cache = CreateCache((CacheConfig[])handler.Create(null, null, section));
            Assert.That(cache[0].Priority, Is.EqualTo(CacheItemPriority.AboveNormal));
        }
示例#2
0
        public void RecognizeNumericPriorityValues()
        {
            const string xmlSimple = "<syscache><cache region='foo' expiration='500' priority='4' /></syscache>";

            var     handler = new SysCacheSectionHandler();
            XmlNode section = GetConfigurationSection(xmlSimple);

            SysCache[] cache = CreateCache((CacheConfig[])handler.Create(null, null, section));
            Assert.That(cache[0].Priority, Is.EqualTo(CacheItemPriority.AboveNormal));
        }
		public void TestGetConfigNullSection()
		{
			var handler = new SysCacheSectionHandler();
			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);
		}
示例#4
0
        public void TestGetConfigNullSection()
        {
            var    handler = new SysCacheSectionHandler();
            var    section = new XmlDocument();
            object result  = handler.Create(null, null, section);

            Assert.That(result, Is.Not.Null);
            Assert.IsTrue(result is CacheConfig[]);
            var caches = result as CacheConfig[];

            Assert.That(caches.Length, Is.EqualTo(0));
        }
        public void TestGetConfigFromFile()
        {
            const string xmlSimple = "<syscache><cache region=\"foo\" expiration=\"500\" priority=\"4\" /></syscache>";

            var handler = new SysCacheSectionHandler();
            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 SysCacheSectionHandler();
            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);
        }
        public void TestGetConfigFromFile()
        {
            const string xmlSimple = "<syscache><cache region=\"foo\" expiration=\"500\" priority=\"4\" /></syscache>";

            var     handler = new SysCacheSectionHandler();
            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);
        }
示例#8
0
        public void TestGetConfigFromFile()
        {
            const string xmlSimple = "<syscache><cache region=\"foo\" expiration=\"500\" priority=\"4\" sliding=\"true\" /></syscache>";

            var     handler = new SysCacheSectionHandler();
            XmlNode section = GetConfigurationSection(xmlSimple);
            object  result  = handler.Create(null, null, section);

            Assert.That(result, Is.Not.Null);
            Assert.IsTrue(result is CacheConfig[]);
            var caches = result as CacheConfig[];

            Assert.That(caches.Length, Is.EqualTo(1));
            Assert.That(caches[0].Properties, Does.ContainKey("cache.use_sliding_expiration"));
        }