/// ------------------------------------------------------------------------------------ /// <summary> /// Adds the given match to the existing key terms table if it is nopt already present. /// </summary> /// ------------------------------------------------------------------------------------ internal void AddKeyTermMatch(KeyTermMatchSurrogate matchSuurrogate) { Word firstWord = Word.FirstWord(matchSuurrogate.TermId); List <KeyTerm> termsStartingWithSameFirstWord; if (!m_keyTermsTable.TryGetValue(firstWord, out termsStartingWithSameFirstWord)) { m_keyTermsTable[firstWord] = termsStartingWithSameFirstWord = new List <KeyTerm>(); } termsStartingWithSameFirstWord.Add(new KeyTerm(matchSuurrogate)); }
public void FirstWord_StringWithLeadingSpaces_ReturnsCorrectWord() { Word word = "tom"; Assert.AreEqual(word, Word.FirstWord(" tom is a dude")); }
public void FirstWord_StringWithOnlySpaces_ReturnsNull() { Assert.IsNull(Word.FirstWord(" ")); }
public void FirstWord_EmptyString_ReturnsNull() { Assert.IsNull(Word.FirstWord("")); }
public void FirstWord_NullString_ReturnsNull() { Assert.IsNull(Word.FirstWord(null)); }
public void FirstWord_StringsWithDifferentFirstWords_ReturnsDifferentWords() { Assert.AreNotEqual(Word.FirstWord("tim is nice"), Word.FirstWord("tom has a frog")); }
public void FirstWord_DifferentStringsWithSameFirstWord_ReturnsSameWord() { Assert.AreEqual(Word.FirstWord("tom is nice"), Word.FirstWord("tom has a frog")); }