コード例 #1
0
        public void Test()
        {
            var dictionary = new AutoEvictingDictionary <string, string>(StringComparer.OrdinalIgnoreCase, 2);

            dictionary.Add("Test", "DataValue");
            Assert.AreEqual("DataValue", dictionary.Get("Test"));
            Assert.AreEqual("DataValue", dictionary.Get("test"));
            dictionary.Increment();
            Assert.AreEqual("DataValue", dictionary.Get("Test"));
            dictionary.Increment();
            Assert.AreEqual(null, dictionary.Get("Test"));
        }
コード例 #2
0
        public void TestDefault()
        {
            var dictionary = new AutoEvictingDictionary <string, string>();

            dictionary.Add("Test", "DataValue");
            Assert.AreEqual("DataValue", dictionary.Get("Test"));
            Assert.AreEqual(null, dictionary.Get("test"));
            dictionary.Increment();
            dictionary.Increment();
            dictionary.Increment();
            Assert.AreEqual("DataValue", dictionary.Get("Test"));
            dictionary.Increment();
            Assert.AreEqual(null, dictionary.Get("Test"));
        }