Esempio n. 1
0
        public void RepeatCounter_CountWordMultipleTimes_CountWord()
        {
            string        aWord      = "test";
            string        aSent      = "test this test so I can pass my test";
            RepeatCounter newCounter = new RepeatCounter(aWord, aSent);
            int           result     = newCounter.CountWord();

            Assert.AreEqual(3, result);
        }
Esempio n. 2
0
        public void RepeatCounter_OnlyCheckExactWord_CountWord()
        {
            string        aWord      = "test";
            string        aSent      = "testing this test sentence test";
            RepeatCounter newCounter = new RepeatCounter(aWord, aSent);
            int           result     = newCounter.CountWord();

            Assert.AreEqual(2, result);
        }
Esempio n. 3
0
        public void RepeatCounter_WordCount_CountWord()
        {
            string        aWord      = "test";
            string        aSent      = "this is a test sentence";
            RepeatCounter newCounter = new RepeatCounter(aWord, aSent);
            int           result     = newCounter.CountWord();

            Assert.AreEqual(1, result);
        }
Esempio n. 4
0
        public void CountWord_SkipsPartialMatches_One()
        {
            string userString = "The cat is a caterer";
            string userWord   = "cat";

            RepeatCounter newRepeat = new RepeatCounter(userString, userWord);

            newRepeat.CountWord();
            int output = newRepeat.WordCount;

            Assert.AreEqual(1, output);
        }
Esempio n. 5
0
        public void CountWord_CanHandleCapitalizedSpellings_One()
        {
            string userString = "The Cat is old";
            string userWord   = "cat";

            RepeatCounter newRepeat = new RepeatCounter(userString, userWord);

            newRepeat.CountWord();
            int output = newRepeat.WordCount;

            Assert.AreEqual(1, output);
        }
Esempio n. 6
0
        public void CountWord_CountInstancesofWord_One()
        {
            string userString = "The cat is old";
            string userWord   = "cat";

            RepeatCounter newRepeat = new RepeatCounter(userString, userWord);

            newRepeat.CountWord();
            int output = newRepeat.WordCount;

            Assert.AreEqual(1, output);
        }
Esempio n. 7
0
        public void CountWord_CountsPlurals_Two()
        {
            string userString = "This cat is one of my favorite cats ever.";
            string userWord   = "cat";

            RepeatCounter newRepeat = new RepeatCounter(userString, userWord);

            newRepeat.CountWord();
            int output = newRepeat.WordCount;

            Assert.AreEqual(2, output);
        }
Esempio n. 8
0
        public void CountWord_CountsMultipleMatches_Four()
        {
            string userString = "One Cat, two Cat, red Cat, blue Cat.";
            string userWord   = "cat";

            RepeatCounter newRepeat = new RepeatCounter(userString, userWord);

            newRepeat.CountWord();
            int output = newRepeat.WordCount;

            Assert.AreEqual(4, output);
        }
Esempio n. 9
0
        public void CountWord2()
        {
            //Arrange
            string        firstWord     = "Pig";
            string        enterSentence = "Two little Pig Pig in the barn";
            int           outPut        = 2;
            RepeatCounter wordCount     = new RepeatCounter(firstWord, enterSentence);

            //Act
            wordCount.CountWord();
            //Assert
            Assert.AreEqual(outPut, wordCount.GetCount());
        }
Esempio n. 10
0
        public void CountWord3()
        {
            //Arrange
            string        firstWord     = "Fish";
            string        enterSentence = "Fish Fish Fish in the sea Fishery";
            int           outPut        = 3;
            RepeatCounter wordCount     = new RepeatCounter(firstWord, enterSentence);

            //Act
            wordCount.CountWord();
            //Assert
            Assert.AreEqual(outPut, wordCount.GetCount());
        }
Esempio n. 11
0
        public void CountWord3_ReturnCount()
        {
            //Arrange
            string        firstWord     = "Fish";
            string        enterSentence = "Fish Fish Fish in the sea Fishery";
            int           outPut        = 3;
            RepeatCounter wordCount     = new RepeatCounter(firstWord);
            //Act
            int expectedResult = wordCount.CountWord(enterSentence);

            //Assert
            Assert.AreEqual(outPut, expectedResult);
        }
Esempio n. 12
0
        public void CountWord()
        {
            //Arrange
            string        firstWord     = "Salmon";
            string        enterSentence = "Salmon";
            int           outPut        = 1;
            RepeatCounter wordCount     = new RepeatCounter(firstWord, enterSentence);

            //Act
            wordCount.CountWord();
            //Assert
            Assert.AreEqual(outPut, wordCount.GetCount());
        }
Esempio n. 13
0
        public void CountWord_ReturnCount()
        {
            //Arrange
            string        firstWord     = "Salmon";
            string        enterSentence = "Salmon";
            int           outPut        = 1;
            RepeatCounter wordCount     = new RepeatCounter(firstWord);
            //Act
            int expectedResult = wordCount.CountWord(enterSentence);

            //Assert
            Assert.AreEqual(outPut, expectedResult);
        }
Esempio n. 14
0
        public void CountWord2_ReturnCount()
        {
            //Arrange
            string        firstWord     = "Pig";
            string        enterSentence = "Two little Pig Pig in the barn";
            int           outPut        = 2;
            RepeatCounter wordCount     = new RepeatCounter(firstWord);
            //Act
            int expectedResult = wordCount.CountWord(enterSentence);

            //Assert
            Assert.AreEqual(outPut, expectedResult);
        }
Esempio n. 15
0
        public void RepeatCounter_Multiples_True()
        {
            // Arrange
            string        inputString = "My dog does not think he is a dog";
            string        inputWord   = "dog";
            RepeatCounter testCount   = new RepeatCounter("dog", "My dog does not think he is a dog");

            //Act
            testCount.SetSentence(inputString);
            testCount.SetWord(inputWord);
            int wordMatches = testCount.CountWord();

            // Assert
            Assert.AreEqual(2, wordMatches);
        }
        public void EmptyStringInsteadWord_true()
        {
            //Arrange
            string        testWord   = " ";
            string        testString = "I eat what i eat in ";
            RepeatCounter newWord    = new RepeatCounter(testWord, testString);


            //Act
            string results = newWord.GetWord();
            string result1 = newWord.GetString();
            int    counter = newWord.CountWord();

            //Assert
            Assert.AreEqual(0, counter);
        }
        public void getTheWordCount_false()
        {
            //Arrange
            string        testWord   = "eat";
            string        testString = "I eat what i eat";
            RepeatCounter newWord    = new RepeatCounter(testWord, testString);


            //Act
            string results = newWord.GetWord();
            string result1 = newWord.GetString();
            int    counter = newWord.CountWord();

            //Assert
            Assert.AreEqual(4, counter);
        }
        public void ToCheckWordsWithPunctuation_true()
        {
            //Arrange
            string        testWord   = "Hello";
            string        testString = "hello; hello, hello.hello?hello:";
            RepeatCounter newWord    = new RepeatCounter(testWord, testString);


            //Act
            string results = newWord.GetWord();
            string result1 = newWord.GetString();
            int    counter = newWord.CountWord();

            //Assert
            Assert.AreEqual(5, counter);
            //it should h=give an error
        }
        public void newSetsOfWords_true()
        {
            //Arrange
            string        testWord   = "Hello";
            string        testString = "hello hello hello";
            RepeatCounter newWord    = new RepeatCounter(testWord, testString);


            //Act
            string results = newWord.GetWord();
            string result1 = newWord.GetString();
            int    counter = newWord.CountWord();

            //Assert
            Assert.AreEqual(3, counter);
            //it should h=give an error
        }