public void TestThreeElements() { string[] value = new string[] { "один", "два", "три" }; var table = new HashTable(3); table.PutPair(1, value[0]); table.PutPair(2, value[1]); table.PutPair(3, value[2]); Assert.AreEqual(table.GetValueByKey(1), value[0]); Assert.AreEqual(table.GetValueByKey(2), value[1]); Assert.AreEqual(table.GetValueByKey(3), value[2]); }
public void HashTableOverwrite() { var hashTable = new HashTable(1); var key = "key"; var value = "value"; hashTable[key] = "valueToOverwrite"; hashTable[key] = value; Assert.AreEqual(value, hashTable.GetValueByKey(key)); }
public void TestManyElements() { int size = 100000; var table = new HashTable(size); for (int i = 0; i < size; i++) { table.PutPair(i, i + 1); } Assert.AreEqual(table.GetValueByKey(70000), 70001); }