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());
            }
        }