/// <summary> /// Add suggested words for misspelled words to the combo box. /// </summary> /// <created>art2m,5/12/2019</created> /// <changed>art2m,5/12/2019</changed> private void AddSuggestions() { var swc = new SuggestedWordsCollection(); this.cboWord.Items.Clear(); for (var index = 0; index < swc.ItemsCount(); index++) { this.cboWord.Items.Add(swc.GetItemAt(index)); } swc.ClearCollection(); this.cboWord.DroppedDown = true; }
public void CheckDictionary_ValidateSuggestionsFound() { var collSugWords = new SuggestedWordsCollection(); var slc = new SpellingListClass(); // Arrange const string Word = "finnd"; // Act slc.CheckDictionary(Word); var retVal = collSugWords.ItemsCount(); // Assert Assert.AreNotEqual(retVal, 0, "retVal should be larger as it should have a list of words."); }
/// <summary> /// Gets list of words from dictionary for the misspelled word. /// </summary> /// <param name="word">Misspelled word.</param> /// <created>art2m,5/10/2019</created> /// <changed>art2m,5/10/2019</changed> public static void CheckDictionary(string word) { var sugWords = new SuggestedWordsCollection(); List <string> suggestions; using (var hunspell = new Hunspell("en_us.aff", "en_us.dic")) { suggestions = hunspell.Suggest(word); } foreach (var item in suggestions) { sugWords.AddItem(item); } }