示例#1
0
        public void WordsCanExist()
        {
            HashTable newTable = new HashTable(99);

            newTable.AddHash("dog", "cat");

            Assert.True(newTable.HashExists("dog"));
        }
示例#2
0
        public void CollisionIsInevitible()
        {
            HashTable newTable    = new HashTable(1000);
            string    newKeyOne   = "Taco";
            string    newValueOne = "Delicious";

            string newKeyTwo   = "Cato";
            string newValueTwo = "Cute";

            newTable.AddHash(newKeyOne, newValueOne);
            newTable.AddHash(newKeyTwo, newValueTwo);

            string result       = newTable.GetFromTable(newKeyOne);
            string secondResult = newTable.GetFromTable(newKeyTwo);

            Assert.Equal("Delicious", result);
            Assert.Equal("Cute", secondResult);
        }
示例#3
0
        public void CanReturnNull()
        {
            HashTable newTable = new HashTable(100);
            string    newKey   = "dog";
            string    newValue = "wally";

            newTable.AddHash(newKey, newValue);

            string result = newTable.GetFromTable("Ian");

            Assert.Null(result);
        }