public void AutoCompleteTest() { TranslationDictionary myTransDict = new TranslationDictionary(); myTransDict.Languages = new Language[] { new Language("german", new Word[] { new Word("hallo", "hello"), new Word("der", "the"), new Word("sein", "to be"), new Word("ist", "be"), new Word("zu", "to"), new Word("von", "of") }), new Language("chinese", new Word[] { new Word("nihau", "hello"), new Word("li", "the"), new Word("lihe", "to be"), new Word("me", "be"), new Word("maho", "to"), new Word("wuvong", "of") }) }; string result = myTransDict.AutoComplete("wu"); Assert.AreEqual("wuvong", result); result = myTransDict.AutoComplete("hall"); Assert.AreEqual("hallo", result); }
public string GetAutoComplete(string StartsWith) { if (string.IsNullOrWhiteSpace(StartsWith)) { return(null); } return(MyTranslationDictionary.AutoComplete(StartsWith)); }