public void CanCopyTo() { var pq = new TestPriorityQueue <char>(); foreach (char c in "hello") { pq.Add(c); } var array = new char[pq.Count]; pq.CopyTo(array, 0); // The items in the array are in "heap array order", // but that's an undocumented implementation detail; // officially the ordering is undefined, so sort: Array.Sort(array); Assert.True(array.SequenceEqual("ehllo".ToCharArray())); }