public static void MyClassInitialize(TestContext testContext) { var min = -100; _sortedList = ListProvider.GetIntList(1000, min, 100, SortingCondition.Sorted); _elementContainedInList = _sortedList.GetElementContainedInList(); _elementNotContainedInList = min - 1; }
private static void SearchAlgorithmShell(Func<IList<int>, int, int?> searchingFunction, IList<int> sortedList, bool printCollection = false) { if (printCollection) sortedList.PrintCollection(); var timer = new Timer(); var element = sortedList.GetElementContainedInList(); timer.Start(); var elementIndex = sortedList.Search(element, searchingFunction); Console.WriteLine("{0}{1} seconds", searchingFunction.Method.Name.PadRight(40), timer.GetTime()); if (printCollection) { Console.WriteLine("Element {0} at {1} position".PadLeft(40), element, elementIndex); } }