Esempio n. 1
0
        public void Sort_AscMin_Test()
        {
            SortMatrix testSort = new SortMatrix(OrderType.Asc, ComparisonType.MinElement);

            int[,] testArray = (int[, ])_testArray.Clone();
            testSort.Sort(testArray);
            CollectionAssert.AreEqual(testArray, _expectedArrayAfterAscMin);
        }
Esempio n. 2
0
        public void Sort_DescSum_Test()
        {
            SortMatrix testSort = new SortMatrix(OrderType.Desc, ComparisonType.SumRows);

            int[,] testArray = (int[, ])_testArray.Clone();
            testSort.Sort(testArray);
            CollectionAssert.AreEqual(testArray, _expectedArrayAfterDescSum);
        }
Esempio n. 3
0
        public void SortMatrixRowSumAscTest()
        {
            int[][] input      = SortMatrix.matrixHardCode;
            int[][] expected   = { new int[] { 0, 1 }, new int[] { 2, 3 }, new int[] { 4, 5 } };
            var     sortMatrix = new SortMatrix(new ComparerSumsOfMatrixRowElements());
            var     actual     = sortMatrix.SortMatrixRows(input);

            CollectionAssert.AreEqual(expected, actual);
        }
Esempio n. 4
0
        public void Sort_NullReferenceException_Test()
        {
            SortMatrix sort = new SortMatrix(OrderType.Asc, ComparisonType.MaxElement);

            Assert.Throws <NullReferenceException>(() => sort.Sort(null));
        }
Esempio n. 5
0
        public void Sort_ArgumentException_Test(OrderType orderType, ComparisonType comparisonType)
        {
            SortMatrix sort = null;

            Assert.Throws <ArgumentException>(() => sort = new SortMatrix(orderType, comparisonType));
        }