Пример #1
0
        public void Sort_Tests(int[,] array, Sorts strategy, SortOrder sortOrder, int[,] expectedArray)
        {
            SortContext sortContext = new SortContext(strategy);

            sortContext.ExecuteSort(array, sortOrder);
            Assert.AreEqual(array, expectedArray);
        }
Пример #2
0
        public void Sort_Tests(int [,] array, IStrategy strategy, Func <int, int, bool> funcOrderSort, int[,] expectedArray)
        {
            SortContext sortContext = new SortContext(strategy);

            sortContext.ExecuteSort(array, funcOrderSort);
            Assert.AreEqual(array, expectedArray);
        }
        public void SortArray_AscendingSortByMin_ReturnsOutputArray()
        {
            var sortContext = new SortContext();

            sortContext.SetSortStrategy(new AscendingSortByMin());

            int[,] expectedArray =
            {
                {  4, 19, -5 },
                {  7,  1,  0 },
                {  9,  6,  2 },
                { 16,  5, 13 }
            };

            int[,] outputArray = sortContext.ExecuteSort(inputArray);

            CollectionAssert.AreEqual(expectedArray, outputArray);
        }