/// ------------------------------------------------------------------------------------
        /// <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"));
 }