예제 #1
0
        public void CountRepeats_MultiWordsMultiCount_two()
        {
            //Arrange
            string        sentInput  = "monkeys like to eat bananas for breakfast and bananas for dinner";
            string        wordInput  = "bananas";
            RepeatCounter newCounter = new RepeatCounter(sentInput, wordInput);

            //Act
            int result = newCounter.CountRepeats(sentInput, wordInput);

            //Assert
            Assert.Equal(2, result);
        }
예제 #2
0
        public void CountRepeats_MultiWordsCloseMatchError_zero()
        {
            //Arrange
            string        sentInput  = "monkeys like to eat bananas";
            string        wordInput  = "banana";
            RepeatCounter newCounter = new RepeatCounter(sentInput, wordInput);

            //Act
            int result = newCounter.CountRepeats(sentInput, wordInput);

            //Assert
            Assert.Equal(0, result);
        }
예제 #3
0
        public void CountRepeats_Punctuation_one()
        {
            //Arrange
            string        sentInput  = "monkeys like to eat bananas.";
            string        wordInput  = "Bananas";
            RepeatCounter newCounter = new RepeatCounter(sentInput, wordInput);

            //Act
            int result = newCounter.CountRepeats(sentInput, wordInput);

            //Assert
            Assert.Equal(1, result);
        }
예제 #4
0
        public void CountRepeats_SingleWord_one()
        {
            //Arrange
            string        sentInput  = "bananas";
            string        wordInput  = "bananas";
            RepeatCounter newCounter = new RepeatCounter(sentInput, wordInput);

            //Act
            int result = newCounter.CountRepeats(sentInput, wordInput);

            //Assert
            Assert.Equal(1, result);
        }
예제 #5
0
        public void CountRepeats_MultiWordsCaseInsensitive_one()
        {
            //Arrange
            string        sentInput  = "monkeys like to eat bananas";
            string        wordInput  = "Bananas";
            RepeatCounter newCounter = new RepeatCounter(sentInput, wordInput);

            //Act
            int result = newCounter.CountRepeats(sentInput, wordInput);

            //Assert
            Assert.Equal(1, result);
        }
예제 #6
0
        public void Test_StringEqual_1()
        {
            //Arrange
            string inputWord = "A";
            string inputText = "A";

            //ACT
            RepeatCounter testInput  = new RepeatCounter(inputWord, inputText);
            int           testResult = testInput.CountRepeats();

            //Assert
            Assert.Equal(testResult, 1);
        }
예제 #7
0
        public void Test_CountLikeWordsInText_8()
        {
            //Arrange
            string inputWord = "buffalo";
            string inputText = "The buffalo is large. Buffalo is my name. The buffalo is large. Buffalo is my name. The buffalo is large. Buffalo is my name. The buffalo is large. Buffalo is my name. Buffalo's Rock!";

            //Act
            RepeatCounter testInput  = new RepeatCounter(inputWord, inputText);
            int           testResult = testInput.CountRepeats();

            //Assert
            Assert.Equal(8, testResult);
        }
예제 #8
0
        public void Test_StringCompareEqualCaseless_1()
        {
            //Arrange
            string inputWord = "buffalo";
            string inputText = "BuFFalO";

            //Act
            RepeatCounter testInput  = new RepeatCounter(inputWord, inputText);
            int           testResult = testInput.CountRepeats();

            //Assert
            Assert.Equal(testResult, 1);
        }
예제 #9
0
 public HomeModule()
 {
     Get["/"] = _ =>
     {
         return(View["forms.cshtml"]);
     };
     Post["/"] = _ =>
     {
         RepeatCounter newRepeatCounter = new RepeatCounter(Request.Form["long-string"]);
         newRepeatCounter.SetTargetWord(Request.Form["target-word"]);
         newRepeatCounter.StringSplitter();
         newRepeatCounter.FindWord();
         return(View["index.cshtml", newRepeatCounter]);
     };
 }
예제 #10
0
 public void RepeatCounterCheck_ForUserInput_0()
 {
   RepeatCounter repeatCounterTest = new RepeatCounter();
   Assert.Equal(0, repeatCounterTest.CounterRepeats("", ""));
 }
예제 #11
0
 public void RepeatCounterCheck_ForUserInputHELLO_HerloHEllohelloHELLO_2()
 {
   RepeatCounter repeatCounterTest = new RepeatCounter();
   Assert.Equal(3, repeatCounterTest.CounterRepeats("HELLO", "Herlo HEllo hello HELLO"));
 }
예제 #12
0
 public void RepeatCounterCheck_ForUserInputHello_HelloGoodbyeHello_2()
 {
   RepeatCounter repeatCounterTest = new RepeatCounter();
   Assert.Equal(2, repeatCounterTest.CounterRepeats("Hello", "Hello Goodbye Hello"));
 }