コード例 #1
0
        public void Sort_ArrayAndAscMaxAbsolutValueComparer_ArraySortedByMaxAbsoluteValueByAsc()
        {
            int[][] array = new int[][]
            {
                new int[] { -1, 2 },
                new int[] { 0, 1, 1, 0 },
                new int[] { 0, 0, 0, 0 },
                new int[] { 3, -5, 2, 0 },
                new int[] { 2, 4, 1 }
            };

            int[][] expected = new int[][]
            {
                new int[] { 0, 0, 0, 0 },
                new int[] { 0, 1, 1, 0 },
                new int[] { -1, 2 },
                new int[] { 2, 4, 1 },
                new int[] { 3, -5, 2, 0 }
            };

            JaggedArray.Sort(array, new AscMaxAbsoluteValueComparer());
            IStructuralEquatable actual = array;

            Assert.IsTrue(actual.Equals(expected, StructuralComparisons.StructuralEqualityComparer));
        }
コード例 #2
0
        public void JaggedArrayTest_SortInnerArrayNull_ExeptionResult()
        {
            int[][] jaggedArray = new int[5][];
            jaggedArray[0] = new int[3] {
                -1, 5, 6
            };
            jaggedArray[1] = null;
            jaggedArray[2] = new int[3] {
                11, 25, 16
            };
            jaggedArray[3] = new int[3] {
                0, -4, 0
            };
            jaggedArray[4] = new int[3] {
                1, 8, 6
            };

            JaggedArray.Sort(jaggedArray, (x, y) => x.Sum() > y.Sum());
        }
コード例 #3
0
        public void JaggedArrayTest_SortNull_ExeptionResult()
        {
            int[][] jaggedArray = null;

            JaggedArray.Sort(jaggedArray, (x, y) => x.Sum() > y.Sum());
        }
コード例 #4
0
 public void Sort_NullAndDescSumElementsComparer_ArgumentNullException()
 {
     JaggedArray.Sort(null, new DescSumElementsComparer());
 }