コード例 #1
0
        public void TestAverageValueOfLengthOfWordsInAList()
        {
            double      expected, actual;
            TextAnalyst frm = new TextAnalyst();

            expected = 4.0;
            actual   = frm.GetAverageWordLength(new List <string> {
                "The", "Quick", "Brown", "Quick", "Fox", "Jumps", "Over", "The", "Lazy", "Dog"
            });
            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void TestListOfShortestWords()
        {
            List <string> expected = new List <string> {
                "The", "Fox", "Dog"
            };
            TextAnalyst   frm    = new TextAnalyst();
            List <string> actual = frm.GetShortestWords(new List <string> {
                "The", "Quick", "Brown", "Quick", "Fox", "Jumps", "Over", "The", "Lazy", "Dog"
            });

            CollectionAssert.AreEqual(expected, actual);
        }
コード例 #3
0
        public void TestListOfShortestWordsWithWordsTheSameLength()
        {
            List <string> expected = new List <string> {
                "The", "Cat", "And", "Dog"
            };
            TextAnalyst   frm    = new TextAnalyst();
            List <string> actual = frm.GetShortestWords(new List <string> {
                "The", "Cat", "And", "Dog"
            });

            CollectionAssert.AreEqual(expected, actual);
        }
コード例 #4
0
        public void TestNumberOfWordsOfACertainLengthInDocumentDifferentCase()
        {
            int expected, actual;

            expected = 2;
            TextAnalyst frm = new TextAnalyst();

            actual = frm.GetNumberOfOccurancesOfWordInWordList("The", new List <string> {
                "the", "Quick", "Brown", "Quick", "Fox", "Jumps", "Over", "The", "Lazy", "Dog"
            });
            Assert.AreEqual(expected, actual);
        }
コード例 #5
0
        public void TestCountOfWordsOfCertainLength()
        {
            List <string> expected = new List <string> {
                "Quick", "Brown", "Jumps"
            };
            TextAnalyst frm = new TextAnalyst();

            List <string> actual = frm.GetWordsOfLength(5, new List <string> {
                "The", "Quick", "Brown", "Quick", "Fox", "Jumps", "Over", "The", "Lazy", "Dog"
            });

            CollectionAssert.AreEqual(expected, actual);
        }