Example #1
0
        private int AddToDictionary(string documentSource)
        {
            _documentReader.Load(documentSource);

            int    wordsCounter = 0;
            string word         = _documentReader.ReadNextWord();

            while (!string.IsNullOrWhiteSpace(word))
            {
                if (_filters.Any(filter => filter.Skip(word)))
                {
                    word = _documentReader.ReadNextWord();
                    continue;
                }

                foreach (IWordFormatter formatter in _formatters)
                {
                    word = formatter.ApplyFormat(word);
                }

                _documentDictionary.Put(word);

                wordsCounter++;
                word = _documentReader.ReadNextWord();
            }

            return(wordsCounter);
        }
Example #2
0
 public void load_by_key_does_not_exist()
 {
     _reader.Load(Guid.NewGuid());
 }