public static void HashTableAddAssert(int personCount, IHashTable ht) { bool result = false; IHashTable localHT = null; if (ht.GetType() == typeof(LinearHashTable)) { localHT = new LinearHashTable(); } else if (ht.GetType() == typeof(ChainedHashTable)) { localHT = new ChainedHashTable(); } Init(personCount, localHT); localHT.Add(new Person(5, "Sasya", "Lapkin", 45)); result = localHT.Equals(ht); Assert.IsTrue(result); }
public static void HashTableDeleteAssert(int personCount, IHashTable ht) { bool result = false; IHashTable localHT = null; if (ht.GetType() == typeof(LinearHashTable)) { localHT = new LinearHashTable(); } else if (ht.GetType() == typeof(ChainedHashTable)) { localHT = new ChainedHashTable(); } switch (personCount) { case 2: localHT.Add(new Person(2, "Vasya", "Pupkin", 42)); break; case 7: localHT.Add(new Person(2, "Vasya", "Pupkin", 42)); localHT.Add(new Person(3, "Vasya", "Papkin", 43)); localHT.Add(new Person(4, "Kasya", "Babkin", 44)); localHT.Add(new Person(5, "Masya", "Lapkin", 45)); localHT.Add(new Person(6, "Figasya", "Lupkin", 46)); localHT.Add(new Person(7, "Pupasya", "Lurkin", 47)); break; default: break; } result = localHT.Equals(ht); Assert.IsTrue(result); }