Пример #1
0
        public void CountWordOccurrences_VerifySingleOccurrence_1()
        {
            int         total          = 0;
            string      word           = "foo";
            string      sentence       = "foo bar";
            WordCounter newWordCounter = new WordCounter(total, word, sentence);

            newWordCounter.CountWordOccurrences();
            System.Console.WriteLine("Get Total in test is " + newWordCounter.GetTotal());
            Assert.AreEqual(1, newWordCounter.GetTotal());
        }
Пример #2
0
        public void GetTotal_GetTotal_String()
        {
            int         total          = 0;
            string      word           = "test";
            WordCounter newWordCounter = new WordCounter(total, word, "");

            Assert.AreEqual(total, newWordCounter.GetTotal());
        }
Пример #3
0
        public void CountWordOccurrences_VerifyNoOccurrences_0()
        {
            int         total          = 0;
            string      word           = "foo";
            string      sentence       = "bar";
            WordCounter newWordCounter = new WordCounter(total, word, sentence);

            Assert.AreEqual(0, newWordCounter.GetTotal());
        }
Пример #4
0
        public void CountWordOccurrences_VerifySingleOccurrenceWhenTwoWordsSameExceptApostrophe_1()
        {
            int         total          = 0;
            string      word           = "can't";
            string      sentence       = "I can't believe you can cant.";
            WordCounter newWordCounter = new WordCounter(total, word, sentence);

            newWordCounter.CountWordOccurrences();
            Assert.AreEqual(1, newWordCounter.GetTotal());
        }
Пример #5
0
        public void SetTotal_SetTotal_string()
        {
            int         total          = 0;
            string      word           = "test";
            WordCounter newWordCounter = new WordCounter(total, word, "");
            int         newTotal       = 1;

            newWordCounter.SetTotal(newTotal);
            Assert.AreEqual(newTotal, newWordCounter.GetTotal());
        }
Пример #6
0
        public void CountWordOccurrences_VerifyMultipleOccurrencesWithDifferentCase_3()
        {
            int         total          = 0;
            string      word           = "coffee";
            string      sentence       = "I went to Starbucks Coffee and got tea instead of coffee because I don't like coffee";
            WordCounter newWordCounter = new WordCounter(total, word, sentence);

            newWordCounter.CountWordOccurrences();
            Assert.AreEqual(3, newWordCounter.GetTotal());
        }