public async Task FailedSearchShouldBeRetried() { var searchEngine = new TestSearchEngine("John", "Joe", "Sarah"); var lookuper = GetLookuper(searchEngine); searchEngine.SetActions(new TestSearchEngineThrowExceptionAction()); var searchResults = lookuper.Lookup(TextsForKeyPresses("Jo")); await searchResults.ShouldHaveSearchResults(new[] { "John", "Joe" }); }
public async Task SearchShouldNotBeWaitedForeverButTimeOut() { var searchEngine = new TestSearchEngine("John", "Joe", "Sarah"); var lookuper = GetLookuper(searchEngine); searchEngine.SetActions(new TestSearchEngineInfiniteAction()); var searchResults = lookuper.Lookup(TextsForKeyPresses("Jo")); await searchResults.ShouldHaveSearchResults(new[] { "John", "Joe" }); }
public async Task ObsoleteSlowSearchShouldNotOverwriteCurrentSearchResultDelayed() { var searchEngine = new TestSearchEngine("John", "Joe", "Sarah"); var lookuper = GetLookuper(searchEngine); searchEngine.SetActions( new TestSearchEngineDelayAction(TimeSpan.FromMilliseconds(800)), new TestSearchEngineDelayAction(TimeSpan.FromMilliseconds(100)) ); var keyPresses = TextsForKeyPressesWithWaitingForEachSearchBeginning(searchEngine.SearchBeginnings, "Jo", "Joh"); await lookuper .Lookup(keyPresses) .ShouldFinishWithSearchResult("John"); }
public async Task ObsoleteSlowSearchShouldNotOverwriteCurrentSearchResultManual() { var searchEngine = new TestSearchEngine("John", "Joe", "Sarah"); TestSearchEngineManualAction search1, search2; var lookuper = GetLookuper(searchEngine); searchEngine.SetActions( search1 = new TestSearchEngineManualAction(), search2 = new TestSearchEngineManualAction() ); var keyPresses = TextsForKeyPressesWithWaitingForEachSearchBeginning(searchEngine.SearchBeginnings, "Jo", "Joh"); var searchResultAssertTask = lookuper .Lookup(keyPresses) .ShouldFinishWithSearchResult("John"); await search2.Complete(); await search1.Complete(); await searchResultAssertTask; }