/// <summary> /// Sorts the haystack pile into color groups. /// </summary> /// <param name="haystack">The haystack instance containing the pile to be sorted.</param> /// <returns>Result containing the sorted, ordered lists of unique straws from the haystack.</returns> public ISortByColorResult SortByColor(IHaystack haystack, ISortByColorResult sortByColorResult) { foreach (var straw in haystack.GetPile()) { sortByColorResult.Add(straw); } return(sortByColorResult); }
public void LoadTest() { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); IHaystackOrganizer haystackOrganizer = new HaystackOrganizer(); ISortByColorResult sortByColorResult = haystackOrganizer.SortByColor(new eBags.PileOfBeans.Haystack.Haystack(), new SortByColorResult()); stopWatch.Stop(); var timeTaken = stopWatch.ElapsedMilliseconds; Assert.IsTrue(timeTaken < 10000, "Expected to finish this within 10 seconds"); }