Beispiel #1
0
        public void RepeatCounter_FormatAndVerifyInputStringWithinRepeatCounter_String()
        {
            //Arrange
            RepeatCounter repeatCounter = new RepeatCounter();

            //Act
            repeatCounter.AddSentence("I took the cat for a walk");
            //Assert
            Assert.AreEqual(" I took the cat for a walk ", repeatCounter.SentenceInput);
        }
Beispiel #2
0
        public void SentenceToArray_IntakesUserSentenceAndReturnsArrayOfWords_WordString()
        {
            //Arrange
            RepeatCounter repeatCounter = new RepeatCounter();

            repeatCounter.AddSentence("I took the cat for a walk");
            //Act
            string[] sentenceArray = RepeatCounter.SentenceToArray(repeatCounter.SentenceInput);
            //Assert
            Assert.AreEqual("walk", sentenceArray[7]);
        }
Beispiel #3
0
        public void WordRepeatCount_TotalsNumberOfTimesUserWordOccursInSentenceArray_integer()
        {
            //Arrange
            RepeatCounter repeatCounter = new RepeatCounter();

            repeatCounter.AddWord("walk");
            repeatCounter.AddSentence("I took my cat Walker for a walk");
            //Act
            int wordCount = repeatCounter.WordRepeatCount();

            //Assert
            Assert.AreEqual(1, wordCount);
        }
Beispiel #4
0
        public void ContainsWord_SearchesForOccuranceUserWordInSentenceArray_True()
        {
            //Arrange
            RepeatCounter repeatCounter = new RepeatCounter();

            repeatCounter.AddWord("walk");
            repeatCounter.AddSentence("I took my cat Walker for a walk");
            //Act
            bool result = repeatCounter.ContainsWord();

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