public void TestRandomNumbers(int count) { TimeSpan fileReading; TimeSpan sorting; Stopwatch watch = new Stopwatch(); watch.Start(); var testDataGenerator = new SortingTestDataGenerator(); IList <int> list = testDataGenerator.CreateRandomNumbers(count).ToList(); watch.Stop(); fileReading = watch.Elapsed; watch.Reset(); watch.Start(); list.SelectionSort(); watch.Stop(); sorting = watch.Elapsed; Console.WriteLine("Time for reading the file: {0}", fileReading); Console.WriteLine("Time for sorting: {0}", sorting); Assert.That(testDataGenerator.SortedList, Is.EquivalentTo(list)); }
public void TestRandomNumbersThreeWaySort(int count) { var watch = new Stopwatch(); var testDataGenerator = new SortingTestDataGenerator(); IList <int> list = testDataGenerator.CreateRandomNumbers(count).ToList(); watch.Start(); list.ThreeWaySort(); watch.Stop(); var sorting = watch.Elapsed; Console.WriteLine("Time for sorting: {0}", sorting); Assert.That(testDataGenerator.SortedList, Is.EquivalentTo(list)); }