public void QuickSelectionSortTest() { var random = new Random(); for (int i = 0; i < 10000; i++) { var array = CommonArrayFunctions.InitIntArray(i / 100 + 1, 0, random.Next(0, i)); var sortedArray = new int[array.Length]; array.CopyTo(sortedArray, 0); var kIndex = random.Next(0, sortedArray.Length - 1); var kValue = SortArray.QuickSelectionSort(sortedArray, kIndex, 0, sortedArray.Length - 1); Assert.AreEqual(array.OrderBy(x => x).ElementAt(kIndex), kValue); } }