public void RecognizeMnemonicPriorityValues()
		{
            const string xmlSimple = "<rtmemorycache><cache region='foo' expiration='500' priority='NotRemovable' /></rtmemorycache>";

			var handler = new RtMemoryCacheSectionHandler();
			XmlNode section = GetConfigurationSection(xmlSimple);
			RtMemoryCache[] cache = CreateCache((CacheConfig[]) handler.Create(null, null, section));
			Assert.That(cache[0].Priority, Is.EqualTo(CacheItemPriority.NotRemovable));
		}
        public void RecognizeNumericPriorityValues()
        {
            const string xmlSimple = "<rtmemorycache><cache region='foo' expiration='500' priority='1' /></rtmemorycache>";

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

            RtMemoryCache[] cache = CreateCache((CacheConfig[])handler.Create(null, null, section));
            Assert.That(cache[0].Priority, Is.EqualTo(CacheItemPriority.NotRemovable));
        }
		public void TestGetConfigNullSection()
		{
			var handler = new RtMemoryCacheSectionHandler();
			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 TestGetConfigNullSection()
        {
            var    handler = new RtMemoryCacheSectionHandler();
            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 = "<rtmemorycache><cache region=\"foo\" expiration=\"500\" priority=\"4\" /></rtmemorycache>";

			var handler = new RtMemoryCacheSectionHandler();
			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 RtMemoryCacheSectionHandler();
            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 = "<rtmemorycache><cache region=\"foo\" expiration=\"500\" priority=\"4\" /></rtmemorycache>";

            var     handler = new RtMemoryCacheSectionHandler();
            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 TestGetConfigFromFile()
        {
            const string xmlSimple = "<rtmemorycache><cache region=\"foo\" expiration=\"500\" sliding=\"true\" /></rtmemorycache>";

            var     handler = new RtMemoryCacheSectionHandler();
            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"));
        }