示例#1
0
        public void Test_SimpleHM_Delete()
        {
            SimpleHashMap <string, int> hm = new SimpleHashMap <string, int>(5);

            hm.Insert("Vish", 150);
            hm.Insert("Renessa", 100);
            hm.Insert("Johnny", 30);
            hm.Insert("Albert", 500);
            hm.Insert("Niam", 35);

            hm.Delete("Niam");

            Assert.ThrowsException <IndexOutOfRangeException>(() =>
            {
                var value = hm["Niam"];
            });

            //exits if key not found
            hm.Delete("David");
        }