예제 #1
0
        public void CheckForMatches_ChecksForOneWordMatch_int()
        {
            ReplaceWords testCase     = new ReplaceWords("cat", "the cat", "dog");
            int          numOfMatches = testCase.CheckForMatches();

            Assert.AreEqual(numOfMatches, 1);
        }
예제 #2
0
        public void CheckForMatches_ChecksForNoMatchAndReturnOriginal_int()
        {
            ReplaceWords testCase     = new ReplaceWords("word", "the cat", "dog");
            int          numOfMatches = testCase.CheckForMatches();

            Assert.AreEqual(numOfMatches, 0);
        }
예제 #3
0
        public void CheckForMatches_ChecksForMultipleWordMatches_int()
        {
            // bug with comma in sentence
            string       longSentence = "the cat Meatball met another cat and became best friends with the cat even though he was an ally cat it didn't matter because he was a good cat friend";
            ReplaceWords testCase     = new ReplaceWords("cat", longSentence, "dog");
            int          numOfMatches = testCase.CheckForMatches();

            Assert.AreEqual(numOfMatches, 5);
        }