/// <summary> /// This method is for checking work of sort. /// </summary> /// <param name="sorter"> Object for sort of inrerface of ISorter<int> </param> /// <exception cref="ArgumentNullException"> Trow when sorter = null </exception> public static void CheckSort(ISorter <int> sorter) { if (sorter == null) { throw new ArgumentNullException("Argument can't be null!"); } int[] amounts = new[] { 5000, 10000, 50000, 100000, 500000, 1000000 }; foreach (var n in amounts) { int range = 10; int[] array = SortChecker.GenerateIntValues(n, range); int[] expected = new int[n]; SortChecker.SortArrays(sorter, array, expected); CollectionAssert.AreEqual(array, expected); } }
public void Sort_BigAmountOfNumbers_ReturnSortedArray() { ISorter <int> sorter = new MergeSorter <int>(); SortChecker.CheckSort(sorter); }