public void Testing_NullComparerParameter_Throwing_ArgumentNulleException() { int[][] Matrix = new int[4][]; Matrix[0] = new int[] { 2, 5, 8, 7, 12, 74 }; //2 Matrix[1] = new int[] { 5, 4, 10, 3, 15 }; //3 Matrix[2] = new int[] { 13, 25, 85, 95, 112, 544 }; //13 Matrix[3] = new int[] { 1, 2, 21, 45, 10 }; //1 int[] keys = { }; BubbleSortDelegate.SortRows(Matrix, Strategy.GetMaxRowsElements(Matrix), new Comparison <int>((a, b) => a.CompareTo(b))); }
public void Testing_DecreasingMinElements_Success() { int[][] Matrix = new int[4][]; Matrix[0] = new int[] { 2, 5, 8, 7, 12, 74 }; //2 Matrix[1] = new int[] { 5, 4, 10, 3, 15 }; //3 Matrix[2] = new int[] { 13, 25, 85, 95, 112, 544 }; //13 Matrix[3] = new int[] { 1, 2, 21, 45, 10 }; //1 BubbleSortDelegate.SortRows(Matrix, Strategy.GetMinRowsElements(Matrix), new Comparison <int>((a, b) => b.CompareTo(a))); int[][] expected = new int[4][]; expected[3] = new int[] { 1, 2, 21, 45, 10 }; expected[2] = new int[] { 2, 5, 8, 7, 12, 74 }; expected[1] = new int[] { 5, 4, 10, 3, 15 }; expected[0] = new int[] { 13, 25, 85, 95, 112, 544 }; for (int i = 0; i < expected.Length; i++) { CollectionAssert.AreEqual(Matrix[i], expected[i]); } }
public void Testing_IncreasingMaxElements_Success() { int[][] Matrix = new int[4][]; Matrix[0] = new int[] { 2, 5, 8, 7, 12, 74 }; //74 Matrix[1] = new int[] { 3, 4, 9, 2, 15 }; //15 Matrix[2] = new int[] { 13, 25, 85, 95, 112, 544 }; //544 Matrix[3] = new int[] { 3, 21, 45, 10 }; //45 BubbleSortDelegate.SortRows(Matrix, Strategy.GetMaxRowsElements(Matrix), new Comparison <int>((a, b) => a.CompareTo(b))); int[][] expected = new int[4][]; expected[0] = new int[] { 3, 4, 9, 2, 15 }; expected[1] = new int[] { 3, 21, 45, 10 }; expected[2] = new int[] { 2, 5, 8, 7, 12, 74 }; expected[3] = new int[] { 13, 25, 85, 95, 112, 544 }; for (int i = 0; i < expected.Length; i++) { CollectionAssert.AreEqual(Matrix[i], expected[i]); } }
public void BubbleSortDelegate_ArgumentNullException(Func <int[][]> func) { int[][] array = func(); int[] keys = null; Assert.Throws <ArgumentNullException>(() => BubbleSortDelegate.SortRows(array, keys, new Comparison <int>((a, b) => a.CompareTo(b)))); }
public int[][] BubbleSortDelegate_ByMinElemntsRowsDesc_CorrectValues(Func <int[][]> func) { int[][] array = func(); BubbleSortDelegate.SortRows(array, KeysForSort.GetMinRowsElements(array), new Comparison <int>((a, b) => b.CompareTo(a))); return(array); }
public int[][] BubbleSortDelegate_ByMinElemntsRows_Succed(Func <int[][]> func) { int[][] array = func(); BubbleSortDelegate.SortRows(array, KeysForSort.GetMinRowsElements(array), new Comparison <int>((a, b) => a.CompareTo(b))); return(array); }
public int[][] BubbleSortDelegate_BySumElemntsRowsDesc_Succed(Func <int[][]> func) { int[][] array = func(); BubbleSortDelegate.SortRows(array, KeysForSort.GetSumRowsElements(array), new Comparison <int>((a, b) => b.CompareTo(a))); return(array); }