コード例 #1
0
        public void CountRepeats_ReturnsCountForandWhenNoOccurence_Integer()
        {
            int           expected = 0;
            RepeatCounter count    = new RepeatCounter("and", "i like icecream,pizza,chocolates");
            int           actual   = count.CountRepeats();

            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void CountRepeats_ReturnsCountForaOccuringMoreThanOnceInMultipleWords_Integer()
        {
            int           expected = 1;
            RepeatCounter count    = new RepeatCounter("a", "a abcde aaab ca");
            int           actual   = count.CountRepeats();

            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        public void WordCounter_RepeatCountsForStringofInts_int()
        {
            RepeatCounter newRepeatCounter = new RepeatCounter("123 34566 78 78 456 78", "78");
            var           output           = 3;
            int           result           = newRepeatCounter.CountRepeats();

            Assert.AreEqual(output, result);
        }
コード例 #4
0
        public void CountRepeats_MatcheWordWithPeriod_1()
        {
            RepeatCounter newCount = new RepeatCounter("Say hello.", "hello");
            int           expected = 1;
            int           actual   = newCount.CountRepeats();

            Assert.AreEqual(expected, actual);
        }
コード例 #5
0
        public void CountRepeats_ReturnsCountForandOccuringMoreThanOnce_Integer()
        {
            int           expected = 2;
            RepeatCounter count    = new RepeatCounter("and", "i like icecream and pizza and chocolates");
            int           actual   = count.CountRepeats();

            Assert.AreEqual(expected, actual);
        }
コード例 #6
0
        public void WordCounter_FullWordMatch_int()
        {
            RepeatCounter newRepeatCounter = new RepeatCounter("I am going to Paris at 7am.", "am");
            var           output           = 1;
            int           result           = newRepeatCounter.CountRepeats();

            Assert.AreEqual(output, result);
        }
コード例 #7
0
        public void CountRepeats_MatchesTwoWords_2()
        {
            RepeatCounter newCount = new RepeatCounter("Hello Hello", "hello");
            int           expected = 2;
            int           actual   = newCount.CountRepeats();

            Assert.AreEqual(expected, actual);
        }
コード例 #8
0
        public void CountRepeats_DoesNotAppearInMultiWordSentence_0()
        {
            RepeatCounter newCount = new RepeatCounter("hello there", "hi");
            int           expected = 0;
            int           actual   = newCount.CountRepeats();

            Assert.AreEqual(expected, actual);
        }
コード例 #9
0
        public void CountRepeats_SentenceContainCapitalLetters_1()
        {
            RepeatCounter testRepeatCounter = new RepeatCounter("Bunny", "I see a bunny");
            int           expected          = 1;
            int           actual            = testRepeatCounter.CountRepeats();

            Assert.AreEqual(expected, actual);
        }
コード例 #10
0
        public void CountRepeats_MatchesOneWordInMiddleOfMultiWordSentence_1()
        {
            RepeatCounter newCount = new RepeatCounter("Why hello there", "hello");
            int           expected = 1;
            int           actual   = newCount.CountRepeats();

            Assert.AreEqual(expected, actual);
        }
コード例 #11
0
        public void CountRepeats_SentenceContainTwoWords_2()
        {
            RepeatCounter testRepeatCounter = new RepeatCounter("you", "I love you and you love me");
            int           expected          = 2;
            int           actual            = testRepeatCounter.CountRepeats();

            Assert.AreEqual(expected, actual);
        }
コード例 #12
0
        public void CountRepeats_SentenceContainPartialWord_0()
        {
            RepeatCounter testRepeatCounter = new RepeatCounter("hou", "I love your house");
            int           expected          = 0;
            int           actual            = testRepeatCounter.CountRepeats();

            Assert.AreEqual(expected, actual);
        }
コード例 #13
0
        public void CountRepeats_SentenceContainOneWord_1()
        {
            RepeatCounter testRepeatCounter = new RepeatCounter("lamp", "I love lamp");
            int           expected          = 1;
            int           actual            = testRepeatCounter.CountRepeats();

            Assert.AreEqual(expected, actual);
        }
コード例 #14
0
        public void CountRepeats_SentenceDoesntContainWord_0()
        {
            RepeatCounter testRepeatCounter = new RepeatCounter("cats", "I love dogs");
            int           expected          = 0;
            int           actual            = testRepeatCounter.CountRepeats();

            Assert.AreEqual(expected, actual);
        }
コード例 #15
0
        public void CountRepeats_MatchesMultipleWordsInMiddleOfMultiWordSentence_6()
        {
            RepeatCounter newCount = new RepeatCounter("You know Dasher and Dancer and Prancer and Vixen, you know Comet and Cupid and Donner and Blitzen", "and");
            int           expected = 6;
            int           actual   = newCount.CountRepeats();

            Assert.AreEqual(expected, actual);
        }
コード例 #16
0
        public void CountRepeats_MatchesOneWordLowerCase_1()
        {
            RepeatCounter newCount = new RepeatCounter("Hello", "hello");
            int           expected = 1;
            int           actual   = newCount.CountRepeats();

            Assert.AreEqual(expected, actual);
        }
コード例 #17
0
        public void WordCounter_RepeatCountsForStringofWords_int()
        {
            RepeatCounter newRepeatCounter = new RepeatCounter("No lemon no melon", "No");
            var           output           = 2;
            int           result           = newRepeatCounter.CountRepeats();

            Assert.AreEqual(output, result);
        }
コード例 #18
0
        public void CountRepeats_PartialMatches_0()
        {
            RepeatCounter newCount = new RepeatCounter("cathedral", "cat");
            int           expected = 0;
            int           actual   = newCount.CountRepeats();

            Assert.AreEqual(expected, actual);
        }
コード例 #19
0
        public void WordCounter_NoWordMatch_int()
        {
            RepeatCounter newRepeatCounter = new RepeatCounter("I am going to London.", "cat");
            var           output           = 0;
            int           result           = newRepeatCounter.CountRepeats();

            Assert.AreEqual(output, result);
        }
コード例 #20
0
        public void CountRepeats_NoMatchesForBlankFields_0()
        {
            RepeatCounter newCount = new RepeatCounter(" ", " ");
            int           expected = 0;
            int           actual   = newCount.CountRepeats();

            Assert.AreEqual(expected, actual);
        }
コード例 #21
0
        public void CountRepeats_UserEntersSentenceWithWordsContainingMatchingWordsReturns3_3()
        {
            RepeatCounter newCount = new RepeatCounter();
            int           expected = 3;

            int actual = newCount.CountRepeats("I was walking my cat to the cathedral. It was a cathartic experience.", "cat");

            Assert.AreEqual(expected, actual);
        }
コード例 #22
0
        public void CountRepeats_UserEntersSentenceWithMatchingWordsReturns3_3()
        {
            RepeatCounter newCount = new RepeatCounter();
            int           expected = 3;

            int actual = newCount.CountRepeats("hello hello how are you doing hello", "Hello");

            Assert.AreEqual(expected, actual);
        }
コード例 #23
0
        public void CountRepeats_UserEntersSentenceWithMatchingWordReturnsOne_1()
        {
            RepeatCounter newCount = new RepeatCounter();
            int           expected = 1;

            int actual = newCount.CountRepeats("Hello there", "Hello");

            Assert.AreEqual(expected, actual);
        }
コード例 #24
0
        public void CountRepeats_UserEntersNonMatchingWordReturnsZero_0()
        {
            RepeatCounter newCount = new RepeatCounter();
            int           expected = 0;

            int actual = newCount.CountRepeats("Goodbye", "Hello");

            Assert.AreEqual(expected, actual);
        }
コード例 #25
0
        public void CountRepeats_IfStringIsReceived_True()
        {
            // Assert.AreEqual(var1, Method(input));

            RepeatCounter testWord = new RepeatCounter();
            string        result   = testWord.CountRepeats();

            Console.WriteLine("result: " + result);
            Assert.IsInstanceOfType(result, typeof(string));
        }
コード例 #26
0
        public void CountRepeats_GiveCount_int()
        {
            //Arrange
            RepeatCounter count  = new RepeatCounter("I am walking my cat to the cats at the cat place", "cat");
            var           output = 2;
            //Act
            int result = count.CountRepeats();

            //Assert
            Assert.AreEqual(output, result);
        }
コード例 #27
0
        public void CountRepeats_CheckingAbsoluteMatch_int()
        {
            //Arrange
            RepeatCounter count  = new RepeatCounter("Cathedral isnt for cats", "cat");
            var           output = 0;
            //Act
            int result = count.CountRepeats();

            //Assert
            Assert.AreEqual(output, result);
        }
コード例 #28
0
        public void CountRepeats_ReturnsHowManyTimesWordisInSentenceAccountingForCapsAndSpecialCharacters_True()
        {
            //Arrange
            RepeatCounter testCounter = new RepeatCounter("This is a programTeST tEst!", "teSt");
            int           expected    = 1;
            //Act
            int actual = testCounter.CountRepeats();

            //Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #29
0
        public void CountRepeats_ReturnsHowManyTimesWordisInSentence_True()
        {
            //Arrange
            RepeatCounter testCounter = new RepeatCounter("This is a test test", "test");
            int           expected    = 2;
            //Act
            int actual = testCounter.CountRepeats();

            //Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #30
0
        public void CountRepeats_CountIsZero_int()
        {
            //Arrange
            RepeatCounter count  = new RepeatCounter("This is a dog", "cat");
            var           output = 0;
            //Act
            int result = count.CountRepeats();

            //Assert
            Assert.AreEqual(output, result);
        }