예제 #1
0
        public void Count_CountsMultipleMatches_Int()
        {
            RepeatCounter myCounter   = new RepeatCounter("hey", "They said hey hey");
            int           actualCount = myCounter.Counter();

            Assert.AreEqual(2, actualCount);
        }
예제 #2
0
        public void GetWord_GetWordWithPunctuation_String()
        {
            RepeatCounter myCounter   = new RepeatCounter("hey", "hey!");
            int           actualCount = myCounter.Counter();

            Assert.AreEqual(1, actualCount);
        }
예제 #3
0
        public void Count_CountsWordsInPhrase_Int()
        {
            RepeatCounter myCounter   = new RepeatCounter("hey", "They said hey");
            int           actualCount = myCounter.Counter();

            Assert.AreEqual(1, actualCount);
        }
예제 #4
0
        public void GetWord_GetASingleWord_String()
        {
            RepeatCounter myCounter   = new RepeatCounter("hey", "hey");
            int           actualCount = myCounter.Counter();

            Assert.AreEqual(1, actualCount);
        }
예제 #5
0
        public void GetWord_GetWordRegardlessOfCase_String()
        {
            RepeatCounter myCounter   = new RepeatCounter("hey", "HeY");
            int           actualCount = myCounter.Counter();

            Assert.AreEqual(1, actualCount);
        }
        public void Counter_ReturnNumberOfRepeats_2()
        {
            string inputWord   = "cats";
            string inputString = "I love cats because cats are awesome cats dog cats";

            Assert.AreEqual(4, RepeatCounter.Counter(inputWord, inputString));
        }
        public void Counter_ReturnNumberOfRepeatsWithNonAlphabet_4()
        {
            string inputWord   = "cat";
            string inputString = "I'm going to go to a cat cafe this weekend to find a fat CAT! Because having a cat would be nice...";

            Assert.AreEqual(3, RepeatCounter.Counter(inputWord, inputString));
        }
        public void Counter_SameStringAndWordInput_1()
        {
            string inputWord   = "cat";
            string inputString = "cat";

            Assert.AreEqual(1, RepeatCounter.Counter(inputWord, inputString));
        }
        public void Counter_StringInputIsEmpty_0()
        {
            string inputWord   = "cat";
            string inputString = "";

            Assert.AreEqual(0, RepeatCounter.Counter(inputWord, inputString));
        }
예제 #10
0
        public void RepeatCounter_NewObjectOfClass_NewObject()
        {
            // Arrange //
            RepeatCounter newCounter = new RepeatCounter();

            // Act//
            newCounter.Counter("Hello.", "This is a test.");
            // Assert //
            Assert.AreEqual(typeof(RepeatCounter), newCounter.GetType());
        }
예제 #11
0
        public void CountMatch_NumberOfMatch_2()
        {
            string input1   = "cat";
            string sentence = "The cat is grey. She is my cat";

            RepeatCounter newInput = new RepeatCounter(input1, sentence);
            int           result   = newInput.Counter();

            Assert.AreEqual(2, result);
        }
예제 #12
0
        public void MatchWord_WordEqual_1()
        {
            string input1   = "cat";
            string sentence = "cat";

            RepeatCounter newInput = new RepeatCounter(input1, sentence);
            int           result   = newInput.Counter();

            Assert.AreEqual(result, 1);
        }
예제 #13
0
        [TestMethod] // Count the occurrences of a word. is it more than 0?
        public void ObjectCountsKeyword_RepeatsCountedCorrectAmount_Equals_True()
        {
            int x = RepeatCounter.Counter("Apples", "Apples to apples: ApPlEs, appLES, APPLES; Also apples.");

            Assert.AreEqual(true, ((x == 6) == true));
        }
예제 #14
0
        [TestMethod] // Count the occurrences of a word. If more than 0 then multiple punctuation marks were turned to spaces.
        public void ObjectCountsKeyword_EliminatesMuliplePunctuationMarks_Equals_True()
        {
            int x = RepeatCounter.Counter("Test", "This is a test--actually a space test--to see... if it drops multiples.");

            Assert.AreEqual(true, (x > 0 == true));
        }