public void AddEntry_called_with_existing_entry_does_not_update_usage_count() { ConfigureProvider(); // try to make this the "t"-word with the highest usage autoComplete.AddEntry("these", new DictionaryEntry("these", 101)); var suggestions = autoComplete.GetSuggestions("t"); Assert.AreNotEqual("these", suggestions.First()); }
public SpellingCorrectionTestResult TestWord(MisspellingTest misspellingTest) { var stopwatch = new Stopwatch(); stopwatch.Start(); var charactersTyped = -1; for (var n = 1; n <= misspellingTest.Misspelling.Length; ++n) { var typedSoFar = misspellingTest.Misspelling.Substring(0, n); var suggestions = managedSuggestion.GetSuggestions(typedSoFar).Take(NumberOfSuggestionsToCheck); if (!suggestions.Any( suggestion => suggestion.Equals(misspellingTest.TargetWord, StringComparison.CurrentCultureIgnoreCase))) { continue; } charactersTyped = n; break; } stopwatch.Stop(); var timeTaken = stopwatch.Elapsed; return(new SpellingCorrectionTestResult(charactersTyped, timeTaken, misspellingTest)); }
public IEnumerable <string> GetSuggestions(string root, bool nextWord) { try { return(managedSuggestions.GetSuggestions(root, nextWord)); } catch (Exception e) { PublishError(this, e); } return(new List <string>()); }
public IEnumerable <string> GetSuggestions(string root, bool nextWord) { return(managedSuggestions.GetSuggestions(root, nextWord)); }