示例#1
0
        public void SplitSentence_VerifySentencePunctuationIgnored_StringArray()
        {
            int    total    = 0;
            string word     = "test";
            string sentence = "I am a sentence.";

            string[]    expectedResult = { "I", "am", "a", "sentence" };
            WordCounter newWordCounter = new WordCounter(total, word, sentence);

            string[] actualResult = newWordCounter.SplitSentence();
            CollectionAssert.AreEqual(expectedResult, actualResult);
        }
示例#2
0
        public void SplitSentence_SplitSentenceWithoutPunctuation_StringArray()
        {
            int    total    = 0;
            string word     = "test";
            string sentence = "I am a sentence";

            string[] expectedResult = { "I", "am", "a", "sentence" };

            WordCounter newWordCounter = new WordCounter(total, word, sentence);

            CollectionAssert.AreEqual(expectedResult, newWordCounter.SplitSentence());
        }
        public void GetStringToCount_ReturnStringsWorkingWith_String()
        {
            //Arrange
            WordCounter newWordCounter = new WordCounter("the", "the yellow bus");

            //Act
            string toCount = newWordCounter.GetWordToCount();
            string toScan  = newWordCounter.GetParaGraph();

            //Assert
            Assert.AreEqual(toScan, "the yellow bus");
        }
        public void GetIndexFromArray_ReturnIndex_String()
        {
            //Arrange
            WordCounter newWordCounter = new WordCounter("dog", "cat and dog");

            //Act
            string paragraph = newWordCounter.GetParaGraph();

            string[] result = newWordCounter.StringToArray();
            string[] blah   = paragraph.Split(' ');

            //Assert
            CollectionAssert.AreEqual(blah, result);
        }
        public void GetTheWordCount_ReturnTheWordCount_Int()
        {
            //Arrange
            WordCounter newWordCounter = new WordCounter("cat", "cat and cat");
            string      paragraph      = newWordCounter.GetParaGraph();
            string      word           = newWordCounter.GetWordToCount();

            string[] test = newWordCounter.StringToArray();

            //Act
            int result = newWordCounter.GetResults();

            //Assert
            Assert.AreEqual(result, 2);
        }
        public void RunNoArgConstructor_ReturnTheWordCount_Int()
        {
            //Arrange
            WordCounter newWordCounter = new WordCounter();

            //Act
            newWordCounter.SetWordToCount("blue,");
            newWordCounter.SetParagraph("the sky is blue, the oceans is blue, the dog is not blue");
            string paragraph = newWordCounter.GetParaGraph();
            string word      = newWordCounter.GetWordToCount();

            string[] test   = newWordCounter.StringToArray();
            int      result = newWordCounter.GetResults();

            //Assert
            Assert.AreEqual(result, 2);
        }