public void QuadraticHashTableOverloadingAddingTest() { IHashTable hashTable = new QuadraticHashTable(2); Assert.IsTrue(hashTable.Add(3)); Assert.IsTrue(hashTable.Add(3)); Assert.IsFalse(hashTable.Add(3), "quadritic hash table should not be able to add element"); Assert.IsTrue(hashTable.Count() == 2, "quadritic hash table count should be 2 after not-successfull adding"); }
public void QuadraticHashTableOverloadingRemoveTest() { IHashTable hashTable = new QuadraticHashTable(2); Assert.IsTrue(hashTable.Add(3)); Assert.IsTrue(hashTable.Add(3)); Assert.IsFalse(hashTable.Add(6), "quadritic hash table should not be able to add element"); Assert.IsFalse(hashTable.Remove(6), "quadritic hash table should not be able to remove not-added element"); Assert.IsTrue(hashTable.Remove(3), "quadritic hash table should be able to remove existed element"); Assert.IsTrue(hashTable.Add(3), "quadritic hash table should be able to add element again"); Assert.IsTrue(hashTable.Count() == 2, "quadritic hash table has 2 elements after testing"); }