public void RemoveRange() { //**************************************** var Random = Initialise(); var Records = new StringKeyDictionary <int>(); var Dictionary = new Dictionary <string, int>(1024); //**************************************** foreach (var Pair in YieldRandom(Random, 1024)) { Dictionary.Add(Pair.Key, Pair.Value); Records.Add(Pair.Key, Pair.Value); } //**************************************** foreach (var Key in Enumerable.Skip <string>(Records.Keys, 256).Take(256)) { Dictionary.Remove(Key); } Records.RemoveRange(256, 256); //**************************************** CollectionAssert.AreEquivalent(Dictionary, Records, "Collections don't match"); foreach (var MyPair in Dictionary) { Assert.IsTrue(Records.TryGetValue(MyPair.Key, out var Value)); Assert.AreEqual(MyPair.Value, Value); } Thread.Sleep(1); }