public void Calculate(double[] argument, double[] result) { var sort = new SelectionSorting(); var testResult = sort.Sort(argument); Assert.AreEqual(result, testResult); }
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); }
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); }
public SelectionSortController(IDataService dservice, SelectionSorting sorting) { this.db = dservice; this.sorting = sorting; }
static void Main() { SelectionSorting.SelectionSortArray(); InsertionSorting.InsertionSortArray(); QuickSorting.QuickSortArray(); }