public void SortTestWithMaxLengthArrayComparer()
 {
     int[][] actual =
     {
         new int[]{2,3,5},
         new int[]{1,2},
         new int[]{4,0,-9,8}
     };
     int[][] expected =
     {
         new int[]{1,2},
         new int[]{2,3,5},
         new int[]{4,0,-9,8}
     };
     MaxLengthArrayComparer comparer = new MaxLengthArrayComparer();
     ArrayComparerDelegate compDelegate = new ArrayComparerDelegate(comparer.Compare);
     JaggedArraySorts.Sort(actual, compDelegate);
     for(int i = 0; i < actual.Length; i++)
         CollectionAssert.AreEqual(expected[i],actual[i]);
 }
Example #2
0
 static void Main(string[] args)
 {
     int[][] actual =
     {
         new int[]{2,3,5},
         new int[]{1,2},
         new int[]{4,0,-9,8},
     };
     int[][] expected =
     {
         new int[]{1,2},
         new int[]{2,3,5},
         new int[]{4,0,-9,8},
     };
     MaxLengthArrayComparer comparer = new MaxLengthArrayComparer(true);
     ArrayComparerDelegate compDelegate = new ArrayComparerDelegate(comparer.Compare);
     JaggedArraySorts.Sort(actual, compDelegate);
     PrintArray(expected, "Expected Array");
     PrintArray(actual, "Actual Array");
     Console.ReadKey(true);
 }
 public void SortTestWithEmptyArrayMustReturnException()
 {
     int[][] actual = {};
     MaxLengthArrayComparer comparer = new MaxLengthArrayComparer();
     JaggedArraySorts.Sort(actual, new ArrayComparerDelegate(comparer.Compare));
 }