Exemple #1
0
        public void Calculate(double[] argument, double[] result)
        {
            var sort       = new SelectionSorting();
            var testResult = sort.Sort(argument);

            Assert.AreEqual(result, testResult);
        }
Exemple #2
0
        public void SelectionSorting_Test()
        {
            var rand = new Random();

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

            var actual = SelectionSorting.Sort(list);

            list.Sort();

            Assert.Equal(list, actual);
        }
Exemple #3
0
        public void FindIndexOfSmallestNumberTest()
        {
            // Arrange
            var numbers = new int[5] {
                5, 4, 0, 2, 1
            };

            // Act
            var selectionSorting = new SelectionSorting(numbers);
            var smallestNumberIsZeroAndIndexIsTwo      = selectionSorting.FindIndexOfSmallestNumberStartingFrom(0);
            var smallestNumberIsStillZeroAndIndexIsTwo = selectionSorting.FindIndexOfSmallestNumberStartingFrom(1);
            var smallestNumberIsOneAndIndexIsFour      = selectionSorting.FindIndexOfSmallestNumberStartingFrom(3);

            // Assert
            Assert.Equal(2, smallestNumberIsZeroAndIndexIsTwo);
            Assert.Equal(2, smallestNumberIsStillZeroAndIndexIsTwo);
            Assert.Equal(4, smallestNumberIsOneAndIndexIsFour);
        }
Exemple #4
0
 public SelectionSortController(IDataService dservice, SelectionSorting sorting)
 {
     this.db      = dservice;
     this.sorting = sorting;
 }
Exemple #5
0
 static void Main()
 {
     SelectionSorting.SelectionSortArray();
     InsertionSorting.InsertionSortArray();
     QuickSorting.QuickSortArray();
 }