public void TestIntHashTableOfInt() { // update hashtable IntHashTableOfInt T = new IntHashTableOfInt(); Random Rnd = new Random(); int i = 0; for ( ; i < 1000; ++i) { T[i - 500] = Rnd.Next(10000000); } // test IEnumerable implementation int iCount = 0; foreach (IntHashTableOfInt.Entry E in T) { ++iCount; if (E.Value == Int32.MaxValue) { throw new Exception("Null value in IntHashTableOfInt"); } } if (iCount != 1000) { throw new Exception("IntHashTableOfInt as IEnumerable returns invalid entries"); } // test IDictionary implementation if (!T.Contains(100) || !T.Contains(200)) { throw new Exception("IntHashTableOfInt's key resolution error"); } if (T.Count != 1000) { throw new Exception("IntHashTableOfInt.Count returned invalid value: " + T.Count.ToString()); } }