Example #1
0
        public void BubbleSorting_TestMultipleConditions()
        {
            int[,] actual =
            {
                {  801, 235,  124,   86 },
                { 7654, 234, 2347, 2398 },
                { 1237, 383,  820,  963 },
                { 5870, 148, 1298,   10 }
            };

            SortBySum sortingMethodBySum = new SortBySum(true);
            SortByMax sortingMethodByMax = new SortByMax(true);

            BubbleSort.BubbleSorting(actual, sortingMethodBySum, sortingMethodByMax);

            int[,] expected =
            {
                { 7654, 234, 2347, 2398 },
                { 5870, 148, 1298,   10 },
                { 1237, 383,  820,  963 },
                {  801, 235,  124,   86 }
            };

            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public void TestMaxSort(double[,] arrUnSort, bool isDesc, int row, double[,] expected)
        {
            ArraySorter sorter = new ArraySorter();
            SortByMax   max    = new SortByMax();

            sorter.SelectMethod(max);
            Assert.AreEqual(sorter.Sort(isDesc, arrUnSort, row), expected);
        }