public void Sort_PassValidArray_ReturnSortedArray()
        {
            var countingSorting = new CountingSorting();
            var sortedArray     = countingSorting.Sort(_toSortArray, 0, _toSortArray.Length - 1, maxValue: 127);

            CollectionAssert.AreEqual(sortedArray, _referenceSortedArray);
        }
        public void Sort_PassEmptyArray_ReturnEmptyArray()
        {
            var countingSorting = new CountingSorting();
            var sortedArray     = countingSorting.Sort(_emptyArray, 0, _emptyArray.Length - 1, maxValue: 127);

            CollectionAssert.AreEqual(sortedArray, _emptyArray);
        }
        public void Sort_PassOneElementArray_ReturnOneElementArray()
        {
            var countingSorting = new CountingSorting();
            var sortedArray     = countingSorting.Sort(_oneElementArray, 0, _oneElementArray.Length - 1, maxValue: 131);

            CollectionAssert.AreEqual(sortedArray, _oneElementArray);
        }
Esempio n. 4
0
        public void CountingSorting_Test()
        {
            var rand = new Random();

            var maxValue = 200;

            var list = Enumerable
                       .Range(1, 10000)
                       .Select(x => rand.Next(maxValue))
                       .ToList();

            var actual = CountingSorting.Sort(list, maxValue);

            list.Sort();

            Assert.Equal(list, actual);
        }