public void ToArray() { const int TestCount = 10; const int LoopCount = 1248; var random = new Random(); for (int n = 0; n < TestCount; n++) { var list = new List <int>(); var speedyList = new SpeedyList <int>(); for (int i = 0; i < LoopCount; i++) { int index = random.Next(list.Count); list.Insert(index, i); speedyList.Insert(index, i); } Assert.AreEqual(LoopCount, list.Count); Assert.AreEqual(list.Count, speedyList.Count); int[] array1 = list.ToArray(); int[] array2 = speedyList.ToArray(); Assert.AreEqual(array1.Length, array2.Length); for (int i = 0; i < array1.Length; i++) { Assert.AreEqual(array1[i], array2[i]); } } }