Пример #1
0
        public void LookupObjectKey_SameNumericTypeCode()
        {
            var dict = new MultiKeyDictionary2 <object, string>();

            dict.Add("magic", (int)1);
            Assert.True(dict.ContainsKey((int)1));
        }
Пример #2
0
        public void LookupObjectKey_VaryingNumericTypeCode_4()
        {
            var dict = new MultiKeyDictionary2 <object, string>();

            dict.Add("magic", (float)1);
            Assert.True(dict.ContainsKey((double)1));
        }
Пример #3
0
        public void TestSimple()
        {
            var dict = new MultiKeyDictionary2 <string, int>();

            dict.Add(11, "1", "1");
            dict.Add(12, "1", "2");
            dict.Add(21, "2", "1");
            dict.Add(22, "2", "2");

            Assert.True(dict.ContainsKey("1", "1"));
            Assert.True(dict.ContainsKey("1", "2"));
            Assert.True(dict.ContainsKey("2", "1"));
            Assert.True(dict.ContainsKey("2", "2"));

            Assert.AreEqual(11, dict["1", "1"]);
            Assert.AreEqual(12, dict["1", "2"]);
            Assert.AreEqual(21, dict["2", "1"]);
            Assert.AreEqual(22, dict["2", "2"]);
        }