public void TestCtorDictionarySingle()
{
// No exception
var hash = new Hashtable(new Hashtable(), 1f);
// No exception
hash = new Hashtable(new Hashtable(new Hashtable(new Hashtable(new Hashtable(new Hashtable()), 1f), 1f), 1f), 1f);
// []test to see if elements really get copied from old dictionary to new hashtable
Hashtable tempHash = new Hashtable();
// this for assumes that MinValue is a negative!
for (long i = long.MinValue; i < long.MinValue + 100; i++)
{
tempHash.Add(i, i);
}
hash = new Hashtable(tempHash, 1f);
// make sure that new hashtable has the elements in it that old hashtable had
for (long i = long.MinValue; i < long.MinValue + 100; i++)
{
Assert.True(hash.ContainsKey(i));
Assert.True(hash.ContainsValue(i));
}
//[]make sure that there are no connections with the old and the new hashtable
tempHash.Clear();
for (long i = long.MinValue; i < long.MinValue + 100; i++)
{
Assert.True(hash.ContainsKey(i));
Assert.True(hash.ContainsValue(i));
}
}