Exemple #1
0
        public void CountRepeatss_ReturnCaseInsensitiveInputSentence_Score()
        {
            RepeatCounter testRepeatCounter = new RepeatCounter("This is my Dog", "dog");
            int           expected          = 1;
            int           output            = testRepeatCounter.CountRepeats();

            Assert.Equal(expected, output);
        }
Exemple #2
0
        public void CountRepeats_ReturnNone_Score()
        {
            RepeatCounter testRepeatCounter = new RepeatCounter("This is my dog", "cat");
            int           expected          = 0;
            int           output            = testRepeatCounter.CountRepeats();

            Assert.Equal(expected, output);
        }
Exemple #3
0
        public void CountRepeats_ReturnScore_Score()
        {
            RepeatCounter testRepeatCounter = new RepeatCounter("This is my dog and his dog", "dog");
            int           expected          = 2;
            int           output            = testRepeatCounter.CountRepeats();

            Assert.Equal(expected, output);
        }
Exemple #4
0
        public void CountRepeats_ReturnCountForSpecialCharacters_Number()
        {
            //Arrange
            string        userString        = "I have a DOG named Bozo. My dog loves to go on hikes! I love my Dog! Dog, Dog, DOg!";
            string        findWord          = "dog";
            RepeatCounter testRepeatCounter = new RepeatCounter(userString, findWord);
            //Act
            int result = testRepeatCounter.CountRepeats();

            //Assert
            Assert.Equal(6, result);
        }
Exemple #5
0
        public void CountRepeats_ReturnCountForToLowercase_Number()
        {
            //Arrange
            string        userString        = "I have a DOG named Bozo. My dog loves to go on hikes! My dog is awesome.";
            string        findWord          = "dog";
            RepeatCounter testRepeatCounter = new RepeatCounter(userString, findWord);
            //Act
            int result = testRepeatCounter.CountRepeats();

            //Assert
            Assert.Equal(3, result);
        }
Exemple #6
0
        public void CountRepeats_ReturnCountForMatchingWord_Number()
        {
            //Arrange
            string        userString        = "I have a dog named Bozo. My dog loves to go on hikes";
            string        findWord          = "dog";
            RepeatCounter testRepeatCounter = new RepeatCounter(userString, findWord);
            //Act
            int result = testRepeatCounter.CountRepeats();

            //Assert
            Assert.Equal(2, result);
        }
Exemple #7
0
        public void CountRepeats_ReturnCountForMultipleWords_Number()
        {
            //Arrange
            string        userString        = "dog dog dog dog";
            string        findWord          = "dog";
            RepeatCounter testRepeatCounter = new RepeatCounter(userString, findWord);
            //Act
            int result = testRepeatCounter.CountRepeats();

            //Assert
            Assert.Equal(4, result);
        }
Exemple #8
0
        public void CountRepeats_ReturnCountForWord_Number()
        {
            //Arrange
            string        userString        = "dog";
            string        userWord          = "dog";
            RepeatCounter testRepeatCounter = new RepeatCounter(userString, userWord);
            //Act
            int result = testRepeatCounter.CountRepeats();

            //Assert
            Assert.Equal(1, result);
        }
        public HomeModule()
        {
            Get["/"] = _ => {
                return(View["index.cshtml"]);
            };
            Post["/results"] = _ => {
                string        userString = Request.Form["user-string"];
                string        findWord   = Request.Form["find-word"];
                RepeatCounter newCounter = new RepeatCounter(userString, findWord);
                int           result     = newCounter.CountRepeats();
                return(View["results.cshtml", result]);
            };

            Post["/new"] = _ => {
                return(View["index.cshtml"]);
            };
        }