コード例 #1
0
        public void Sort_BySumAscending()
        {
            int[][] testArray =
            {
                new[] { 4, 1, 5 },
                new[] { 7,2 },
                null,
                null,
                new[] { 3, 1,6, 2 }
            };

            var jaggedArrayBySumAsc = new JaggedArrayBySumAscendingSorter();

            int[][] expectedArray =
            {
                new[] { 7, 2 },
                new[] { 4,1, 5 },
                new[] { 3,1, 6, 2 },
                null,
                null
            };

            Sort(testArray, jaggedArrayBySumAsc);

            CollectionAssert.AreEqual(testArray, expectedArray);
        }
コード例 #2
0
        public void Sort_BySumAscending()
        {
            int[][] testArray =
            {
                new[] { 4, 1, 5 },
                new[] { 7,2 },
                null,
                null,
                new[] { 3, 1,6, 2 }
            };

            var jaggedArrayBySumAsc = new JaggedArrayBySumAscendingSorter();

            Func <int[], int[], int> comparisonFunc = jaggedArrayBySumAsc.Compare;

            int[][] expectedArray =
            {
                new[] { 7, 2 },
                new[] { 4,1, 5 },
                new[] { 3,1, 6, 2 },
                null,
                null
            };

            Sort(testArray, comparisonFunc);

            CollectionAssert.AreEqual(testArray, expectedArray);
        }