コード例 #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 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);
        }
コード例 #4
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);
        }
コード例 #5
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);
        }