示例#1
0
        public void GetWordDictRemovesCapitalization()
        {
            var req = new GetPageResponse {
                Content = "<html><body><p>TEsT</p></body></html>"
            };
            var mfw = new MostFrequentWords();
            var res = mfw.GetWordDict(req);

            Assert.Equal(1, res["test"]);
        }
示例#2
0
        public void GetWordDictPicksUpWordsInMultipleTags()
        {
            var req = new GetPageResponse {
                Content = "<html><body><p>test</p><a>test</a><span>test</span></body></html>"
            };
            var mfw = new MostFrequentWords();
            var res = mfw.GetWordDict(req);

            Assert.Equal(3, res["test"]);
        }
示例#3
0
        public void GetWordDictReturnsDictWithSingleEntry()
        {
            var req = new GetPageResponse {
                Content = "<html><body><p>testword</p></body></html>"
            };
            var mfw = new MostFrequentWords();
            var res = mfw.GetWordDict(req);

            Assert.Equal(1, res["testword"]);
        }
示例#4
0
        public void GetWordDictReturnsEmptyDictGivenNoInput()
        {
            var req = new GetPageResponse {
                Content = ""
            };
            var mfw = new MostFrequentWords();
            var res = mfw.GetWordDict(req);

            Assert.Empty(res);
        }
示例#5
0
        public void GetWordDictResultIsSorted()
        {
            var req = new GetPageResponse
            {
                Content = "<html><body><p>1 2 2 3 3 3</p></body></html>"
            };
            var mfw = new MostFrequentWords();
            var res = mfw.GetWordDict(req);

            Assert.Equal("3", res.First().Key);
        }
示例#6
0
        public void GetWordDictRemovesSpecialChars()
        {
            var req = new GetPageResponse
            {
                Content = "<html><body><p>\n | ( ) - +</p></body></html>"
            };
            var mfw = new MostFrequentWords();
            var res = mfw.GetWordDict(req);

            Assert.Empty(res);
        }
示例#7
0
        public void GetWordDictBreaksDownSentance()
        {
            var req = new GetPageResponse {
                Content = "<html><body><p>this is a test</p></body></html>"
            };
            var mfw = new MostFrequentWords();
            var res = mfw.GetWordDict(req);

            Assert.Equal(4, res.Count);
            Assert.Equal(1, res["test"]);
        }