public void TestArray() { List <KeyValuePair <int, string> > sample = new List <KeyValuePair <int, string> >(GetSample()); BTreeDictionary <int, string> data = new BTreeDictionary <int, string>(Comparer, sample); sample.Sort((a, b) => data.Comparer.Compare(a.Key, b.Key)); KeyValuePair <int, string>[] array = data.ToArray(); Assert.AreEqual(sample.Count, array.Length); for (int i = 0; i < sample.Count; i++) { Assert.AreEqual(sample[i].Key, array[i].Key); Assert.AreEqual(sample[i].Value, array[i].Value); } }