/// ------------------------------------------------------------------------------------
        /// <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));
        }
示例#2
0
        public void FirstWord_StringWithLeadingSpaces_ReturnsCorrectWord()
        {
            Word word = "tom";

            Assert.AreEqual(word, Word.FirstWord("  tom is a dude"));
        }
示例#3
0
 public void FirstWord_StringWithOnlySpaces_ReturnsNull()
 {
     Assert.IsNull(Word.FirstWord("    "));
 }
示例#4
0
 public void FirstWord_EmptyString_ReturnsNull()
 {
     Assert.IsNull(Word.FirstWord(""));
 }
示例#5
0
 public void FirstWord_NullString_ReturnsNull()
 {
     Assert.IsNull(Word.FirstWord(null));
 }
示例#6
0
 public void FirstWord_StringsWithDifferentFirstWords_ReturnsDifferentWords()
 {
     Assert.AreNotEqual(Word.FirstWord("tim is nice"), Word.FirstWord("tom has a frog"));
 }
示例#7
0
 public void FirstWord_DifferentStringsWithSameFirstWord_ReturnsSameWord()
 {
     Assert.AreEqual(Word.FirstWord("tom is nice"), Word.FirstWord("tom has a frog"));
 }