예제 #1
0
        private void SimpleSentenceWithoutDotTest(IWordsCounter wordsCounter)
        {
            const string SampleString = "This is a sentence, it is simple";

            wordsCounter.Count(SampleString);

            wordsCounter.CheckIfResultIsProvidedAndNotEmpty();
            wordsCounter.CheckWordInResult("this", 1);
            wordsCounter.CheckWordInResult("is", 2);
            wordsCounter.CheckWordInResult("a", 1);
            wordsCounter.CheckWordInResult("sentence", 1);
            wordsCounter.CheckWordInResult("it", 1);
            wordsCounter.CheckWordInResult("simple", 1);
            wordsCounter.CheckWordInResult(",", 0);
            wordsCounter.CheckWordInResult(".", 0);
            wordsCounter.CheckResultCount(6);
        }
예제 #2
0
        private void SentenceWithDifferentSpacingTest(IWordsCounter wordsCounter)
        {
            const string SampleString = "\t ,  It \nis a sentence,     it \r   \t is simple.";

            wordsCounter.Count(SampleString);

            wordsCounter.CheckIfResultIsProvidedAndNotEmpty();
            wordsCounter.CheckWordInResult("it", 2);
            wordsCounter.CheckWordInResult("is", 2);
            wordsCounter.CheckWordInResult("a", 1);
            wordsCounter.CheckWordInResult("sentence", 1);
            wordsCounter.CheckWordInResult("simple", 1);
            wordsCounter.CheckWordInResult(",", 0);
            wordsCounter.CheckWordInResult(".", 0);
            wordsCounter.CheckResultCount(5);
        }
예제 #3
0
        private void SentenceWithSeparatorsOnlyTest(IWordsCounter wordsCounter)
        {
            const string SampleString = ".;  \t , ()\\~/;";

            wordsCounter.Count(SampleString);

            wordsCounter.CheckIfResultIsEmpty();
        }
예제 #4
0
        private void SentenceWithDifferentBracketsTest(IWordsCounter wordsCounter)
        {
            const string SampleString = "This (is) <a> [sentence], it {is} simple.";

            wordsCounter.Count(SampleString);

            wordsCounter.CheckIfResultIsProvidedAndNotEmpty();
            wordsCounter.CheckWordInResult("this", 1);
            wordsCounter.CheckWordInResult("is", 2);
            wordsCounter.CheckWordInResult("a", 1);
            wordsCounter.CheckWordInResult("sentence", 1);
            wordsCounter.CheckWordInResult("it", 1);
            wordsCounter.CheckWordInResult("simple", 1);
            wordsCounter.CheckWordInResult(",", 0);
            wordsCounter.CheckWordInResult(".", 0);
            wordsCounter.CheckResultCount(6);
        }
예제 #5
0
        private void SentenceWithDifferentSeparatorsTest(IWordsCounter wordsCounter)
        {
            const string SampleString = "This,is;a/sentence\\it(is<simple.";

            wordsCounter.Count(SampleString);

            wordsCounter.CheckIfResultIsProvidedAndNotEmpty();
            wordsCounter.CheckWordInResult("this", 1);
            wordsCounter.CheckWordInResult("is", 2);
            wordsCounter.CheckWordInResult("a", 1);
            wordsCounter.CheckWordInResult("sentence", 1);
            wordsCounter.CheckWordInResult("it", 1);
            wordsCounter.CheckWordInResult("simple", 1);
            wordsCounter.CheckWordInResult(",", 0);
            wordsCounter.CheckWordInResult(".", 0);
            wordsCounter.CheckResultCount(6);
        }
 private void WhitespaceSentenceTest5(IWordsCounter counter)
 {
     counter.Count(" \t\t  \r\n   ");
 }
예제 #7
0
        private void SentenceDifferentCaseTest(IWordsCounter wordsCounter)
        {
            const string SampleString = "IT Is a sentence, it iS simple.";

            wordsCounter.Count(SampleString);

            wordsCounter.CheckIfResultIsProvidedAndNotEmpty();
            wordsCounter.CheckWordInResult("it", 2);
            wordsCounter.CheckWordInResult("is", 2);
            wordsCounter.CheckWordInResult("a", 1);
            wordsCounter.CheckWordInResult("sentence", 1);
            wordsCounter.CheckWordInResult("simple", 1);
            wordsCounter.CheckWordInResult(",", 0);
            wordsCounter.CheckWordInResult(".", 0);
            wordsCounter.CheckResultCount(5);
        }
 private void WhitespaceSentenceTest4(IWordsCounter counter)
 {
     counter.Count("\r");
 }
 private void NullSentenceTest(IWordsCounter counter)
 {
     counter.Count(null);
 }
 private void MoreThanOneSentenceTest3(IWordsCounter counter)
 {
     counter.Count("This is first sentence. Is there a second sentence?");
 }
 private void MoreThanOneSentenceTest2(IWordsCounter counter)
 {
     counter.Count("This is first sentence! This is second sentence.");
 }
 private void EmptySentenceTest(IWordsCounter counter)
 {
     counter.Count(string.Empty);
 }