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); }
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); }
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); }
public void Sort_NullReferenceException_Test() { SortMatrix sort = new SortMatrix(OrderType.Asc, ComparisonType.MaxElement); Assert.Throws <NullReferenceException>(() => sort.Sort(null)); }
public void Sort_ArgumentException_Test(OrderType orderType, ComparisonType comparisonType) { SortMatrix sort = null; Assert.Throws <ArgumentException>(() => sort = new SortMatrix(orderType, comparisonType)); }