示例#1
0
        public void NullComparatorNegativeTest()
        {
            JaggedArraySortingClass.MyComparator comp = null;

            Assert.Throws <ArgumentNullException>(() => JaggedArraySortingClass.BubbleSortWithComparator(actualArray1, comp, ascending: true));
            Assert.Throws <ArgumentNullException>(() => JaggedArraySortingClass.BubbleSortWithComparator(actualArray1, comp, ascending: false));
        }
示例#2
0
        public void EmptyArrayNegativeTest()
        {
            JaggedArraySortingClass.MyComparator comp = new MinRowValueComparator().Compare;

            Assert.Throws <ArgumentException>(() => JaggedArraySortingClass.BubbleSortWithComparator(new int[][] { }, comp, ascending: true));
            Assert.Throws <ArgumentException>(() => JaggedArraySortingClass.BubbleSortWithComparator(new int[][] { }, comp, ascending: false));
        }
示例#3
0
        public void NullParameterNegativeTest()
        {
            JaggedArraySortingClass.MyComparator comp = new MinRowValueComparator().Compare;

            Assert.Throws <ArgumentNullException>(() => JaggedArraySortingClass.BubbleSortWithComparator(null, comp, ascending: true));
            Assert.Throws <ArgumentNullException>(() => JaggedArraySortingClass.BubbleSortWithComparator(null, comp, ascending: false));
        }
示例#4
0
        public void RowSumDescendingSort()
        {
            JaggedArraySortingClass.BubbleSortByRowSum(actualArray1, false);
            Assert.AreEqual(expectedArray1, actualArray1);

            JaggedArraySortingClass.BubbleSortByRowSum(actualArray2, false);
            Assert.AreEqual(expectedArrayForSumDescendingSort, actualArray2);
        }
示例#5
0
        public void RowMaxValueDescendingSort()
        {
            JaggedArraySortingClass.BubbleSortByMaxRowValue(actualArray1, false);
            Assert.AreEqual(expectedArray1, actualArray1);

            JaggedArraySortingClass.BubbleSortByMaxRowValue(actualArray2, false);
            Assert.AreEqual(expectedArrayForMaxValueDescendingSort, actualArray2);
        }
示例#6
0
        public void RowMinValueAscendingSort()
        {
            JaggedArraySortingClass.BubbleSortByMinRowValue(actualArray1, true);
            Assert.AreEqual(expectedArray1, actualArray1);

            JaggedArraySortingClass.BubbleSortByMinRowValue(actualArray2, true);
            Assert.AreEqual(expectedArrayForMinValueAscendingSort, actualArray2);
        }
示例#7
0
        public void RowSumAscendingSort()
        {
            JaggedArraySortingClass.MyComparator comp = new RowSumComparator().Compare;

            JaggedArraySortingClass.BubbleSortWithComparator(actualArray1, comp, true);
            Assert.AreEqual(expectedArray1, actualArray1);

            JaggedArraySortingClass.BubbleSortWithComparator(actualArray2, comp, true);
            Assert.AreEqual(expectedArrayForSumAscendingSort, actualArray2);
        }
示例#8
0
        public void RowMaxValueDescendingSort()
        {
            JaggedArraySortingClass.MyComparator comp = new MaxRowValueComparator().Compare;

            JaggedArraySortingClass.BubbleSortWithComparator(actualArray1, comp, false);
            Assert.AreEqual(expectedArray1, actualArray1);

            JaggedArraySortingClass.BubbleSortWithComparator(actualArray2, comp, false);
            Assert.AreEqual(expectedArrayForMaxValueDescendingSort, actualArray2);
        }
示例#9
0
 public void EmptyArrayNegativeTest()
 {
     Assert.Throws <ArgumentException>(() => JaggedArraySortingClass.BubbleSortByRowSum(new int[][] { }, ascending: true));
     Assert.Throws <ArgumentException>(() => JaggedArraySortingClass.BubbleSortByRowSum(new int[][] { }, ascending: false));
 }
示例#10
0
 public void NullParameterNegativeTest()
 {
     Assert.Throws <ArgumentNullException>(() => JaggedArraySortingClass.BubbleSortByRowSum(null, ascending: true));
     Assert.Throws <ArgumentNullException>(() => JaggedArraySortingClass.BubbleSortByRowSum(null, ascending: false));
 }