public void BubbleSortDelegate_SortSummElementDescendArray_Axpected_OverflowException() { Random random = new Random(); int lengthRow = 100; int[][] inputArray = new int[lengthRow][]; for (int i = 0; i < lengthRow; ++i) { var lengthColumn = random.Next(100000, 1000000); inputArray[i] = new int[lengthColumn]; if (lengthColumn != 0) { for (int j = 0; j < lengthColumn; ++j) { inputArray[i][j] = random.Next(-100, 100000); } } } var comparer = new SortSummElementDescendArrayWithoutInterface(); Func <int[], int[], int> delegatInput = comparer.Compare; Assert.Throws <OverflowException>(() => BubbleSortAcrossDelegate.BubbleSortDelegate(inputArray, delegatInput)); }
public void BubbleSortDelegate_SortSummElementDescendArray_Axpected_ArgumentNullException() { int[][] inputArray = null; var comparer = new SortSummElementDescendArrayWithoutInterface(); Func <int[], int[], int> delegatInput = comparer.Compare; Assert.Throws <ArgumentNullException>(() => BubbleSortAcrossDelegate.BubbleSortDelegate(inputArray, delegatInput)); }
public void BubbleSortDelegate_SortSummElementDescendArray_With_Valid_Data() { var inputArray = HelperSort.GetJaggedArray(); var comparer = new SortSummElementDescendArrayWithoutInterface(); Func <int[], int[], int> delegatInput = comparer.Compare; BubbleSortAcrossDelegate.BubbleSortDelegate(inputArray, delegatInput); var outputSummRowArray = HelperSort.SortSummDescendHelper(inputArray).Item2; Assert.IsTrue(HelperSort.SortSummDescendHelper(inputArray).Item1); }