Beispiel #1
0
        public void CheckNumberOccurence_GetCountForOccurrence_Int()
        {
            //Arrange
            string        word          = "car";
            string        word2         = "card";
            string        wordUpperCase = "CAR";
            string        sentence      = "I need to buy a new car, a blue car.";
            RepeatCounter userInput     = new RepeatCounter(word, sentence);
            //Act
            string userWord                  = userInput.GetUserWord();
            string userSentence              = userInput.GetUserSentence();
            int    resultCheckCount          = userInput.CheckNumberOccurence(userWord, userSentence);
            int    resultCheckCount2         = userInput.CheckNumberOccurence(word2, userSentence);
            int    resultCheckCountUpperCase = userInput.CheckNumberOccurence(wordUpperCase, userSentence);

            //Assert
            Assert.AreEqual(2, resultCheckCount);
            Assert.AreEqual(0, resultCheckCount2);
            Assert.AreEqual(2, resultCheckCountUpperCase);
        }