Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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]);
     };
 }
Esempio n. 10
0
 public void RepeatCounterCheck_ForUserInput_0()
 {
   RepeatCounter repeatCounterTest = new RepeatCounter();
   Assert.Equal(0, repeatCounterTest.CounterRepeats("", ""));
 }
Esempio n. 11
0
 public void RepeatCounterCheck_ForUserInputHELLO_HerloHEllohelloHELLO_2()
 {
   RepeatCounter repeatCounterTest = new RepeatCounter();
   Assert.Equal(3, repeatCounterTest.CounterRepeats("HELLO", "Herlo HEllo hello HELLO"));
 }
Esempio n. 12
0
 public void RepeatCounterCheck_ForUserInputHello_HelloGoodbyeHello_2()
 {
   RepeatCounter repeatCounterTest = new RepeatCounter();
   Assert.Equal(2, repeatCounterTest.CounterRepeats("Hello", "Hello Goodbye Hello"));
 }