Esempio n. 1
0
        public void WordAndPuncts_initialSpace()
        {
            CharacterCategorizer       cat   = new CharacterCategorizer("", "", "");
            IEnumerable <WordAndPunct> words = cat.WordAndPuncts(" Dude ");

            using (IEnumerator <WordAndPunct> wordCollection = words.GetEnumerator())
            {
                Assert.IsTrue(wordCollection.MoveNext());
                CheckWordAndPunct(wordCollection.Current, "Dude", " ", 1);
                Assert.IsFalse(wordCollection.MoveNext());
            }
        }
Esempio n. 2
0
        public void WordAndPuncts_initialSpaceFollowedByNumbers()
        {
            CharacterCategorizer       cat   = new CharacterCategorizer("", "", "");
            IEnumerable <WordAndPunct> words = cat.WordAndPuncts("1 2 3");

            using (IEnumerator <WordAndPunct> wordCollection = words.GetEnumerator())
            {
                Assert.IsTrue(wordCollection.MoveNext());
                CheckWordAndPunct(wordCollection.Current, "1", " ", 0);
                Assert.IsTrue(wordCollection.MoveNext());
                CheckWordAndPunct(wordCollection.Current, "2", " ", 2);
                Assert.IsTrue(wordCollection.MoveNext());
                CheckWordAndPunct(wordCollection.Current, "3", "", 4);
                Assert.IsFalse(wordCollection.MoveNext());
            }
        }
Esempio n. 3
0
        public void WordAndPuncts_numberInWord()
        {
            CharacterCategorizer       cat   = new CharacterCategorizer("", "", "");
            IEnumerable <WordAndPunct> words = cat.WordAndPuncts("This is test1.");

            using (IEnumerator <WordAndPunct> wordCollection = words.GetEnumerator())
            {
                Assert.IsTrue(wordCollection.MoveNext());
                CheckWordAndPunct(wordCollection.Current, "This", " ", 0);
                Assert.IsTrue(wordCollection.MoveNext());
                CheckWordAndPunct(wordCollection.Current, "is", " ", 5);
                Assert.IsTrue(wordCollection.MoveNext());
                CheckWordAndPunct(wordCollection.Current, "test1", ".", 8);
                Assert.IsFalse(wordCollection.MoveNext());
            }
        }
Esempio n. 4
0
        /// --------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="TextFileDataSource"/> class.
        /// </summary>
        /// <param name="scrChecksDllFile">The DLL that contains the CharactersCheck class</param>
        /// <param name="scrCheck">Name of the scripture check to use</param>
        /// <param name="fileData">An array of strings with the lines of data from the file.</param>
        /// <param name="scrRefFormatString">Format string used to format scripture references.</param>
        /// <param name="parameters">Checking parameters to send the check.</param>
        /// <param name="categorizer">The character categorizer.</param>
        /// --------------------------------------------------------------------------------
        public TextFileDataSource(string scrChecksDllFile, string scrCheck, string[] fileData,
                                  string scrRefFormatString, Dictionary <string, string> parameters,
                                  CharacterCategorizer categorizer)
        {
            m_scrChecksDllFile     = scrChecksDllFile;
            m_scrCheck             = scrCheck;
            m_characterCategorizer = (categorizer != null) ? categorizer : new CharacterCategorizer();
            m_params  = parameters;
            m_tftList = new List <ITextToken>();
            int i = 1;

            foreach (string line in fileData)
            {
                m_tftList.Add(new TextFileToken(line, i++, scrRefFormatString));
            }
        }