public void Execute(string label, DataStore dataStore, IStationFinderStrategy finder) { Console.WriteLine($"Running performance test for For Strategy [{label}]..."); var stopwatch = new Stopwatch(); var stations = dataStore.GetStations(); stopwatch.Start(); foreach (var station in stations) { for (int i = 1; i <= station.Length; i++) { finder.GetSuggestions(station.Substring(0, i)); } } stopwatch.Stop(); Console.WriteLine($"TimeTaken: {stopwatch.Elapsed.TotalSeconds} seconds"); }
public StationFinder(IStationFinderStrategy stationFinder) { this.stationFinder = stationFinder; }