Пример #1
0
        public void TestAddRemoveByKey()
        {
            LurchTableTest <int, string> test = new LurchTableTest <int, string>();

            for (int i = 0; i < 10; i++)
            {
                test.Add(i, i.ToString());
            }

            for (int i = 0; i < 10; i++)
            {
                Assert.IsTrue(test.ContainsKey(i));
            }

            string cmp;

            for (int i = 0; i < 10; i++)
            {
                Assert.IsTrue(test.TryGetValue(i, out cmp) && cmp == i.ToString());
            }

            for (int i = 0; i < 10; i++)
            {
                Assert.IsTrue(test.Remove(i));
            }
        }
Пример #2
0
        public void TestComparer()
        {
            var test = new LurchTableTest <string, string>(StringComparer.OrdinalIgnoreCase);

            test["a"] = "b";
            Assert.IsTrue(test.ContainsKey("A"));

            test      = new LurchTableTest <string, string>(StringComparer.OrdinalIgnoreCase);
            test["a"] = "b";
            Assert.IsTrue(test.ContainsKey("A"));
        }