Пример #1
0
        public void SortingByMaxElementsTest_WithNormalArray()
        {
            int[][] source = new int[][]
            {
                new int[] { 1, 2, 3, 4, 5 },
                new int[] { -1, -2, -3, -4 },
                new int[] { 6, 7 },
                new int[] { -10, -20 }
            };

            int[][] expected = new int[][]
            {
                new int[] { -10, -20 },
                new int[] { -1, -2, -3, -4 },
                new int[] { 1, 2, 3, 4, 5 },
                new int[] { 6, 7 }
            };
            SortingJaggedArray.SortingByMaxElements(source);

            Assert.AreEqual(source, expected);
        }
Пример #2
0
        public void SortingByMaxElementsTest_WithOneElementInRow()
        {
            int[][] source = new int[][]
            {
                new int[] { 10 },
                new int[] { -100 },
                new int[] { 1000 },
                new int[] { -1000 },
                new int[] { 200 },
            };

            int[][] expected = new int[][]
            {
                new int[] { -1000 },
                new int[] { -100 },
                new int[] { 10 },
                new int[] { 200 },
                new int[] { 1000 }
            };
            SortingJaggedArray.SortingByMaxElements(source);

            Assert.AreEqual(source, expected);
        }
Пример #3
0
 public void SortingByMaxElementsTests_WithEmptyRow_ThrowArgumentException()
 => Assert.Throws <ArgumentException>(() => SortingJaggedArray.SortingByMaxElements(new int[][] { new int[] { 1, 2 }, new int[] { } }));
Пример #4
0
 public void SortingByMaxElementsTests_WithEmptyArray_ThrowArgumentException()
 => Assert.Throws <ArgumentException>(() => SortingJaggedArray.SortingByMaxElements(new int[0][]));
Пример #5
0
 public void SortingByMaxElementsTests_WithNullArray_ThrowArgumentNullException()
 => Assert.Throws <ArgumentNullException>(() => SortingJaggedArray.SortingByMaxElements(null));