Exemple #1
0
        public IEnumerable <KeywordStat> GetPageStats(string html)
        {
            var htmlDocument   = _htmlDocumentFactory.Create(html);
            var metaKeywordTag = _metaKeywordsTagParser.GetMetaKeywordTag(htmlDocument.DocumentNode);
            var keywords       = _metaKeywordsTagParser.GetKeywordsFromMetaKeywordTag(metaKeywordTag);

            var result = new List <KeywordStat>();

            keywords.ToList().ForEach(k => result.Add(new KeywordStat
            {
                Keyword = k,
                Count   = _bodyParser.CountKeywordOccurrences(htmlDocument.DocumentNode, k)
            }));
            return(result);
        }
Exemple #2
0
        public void GetMetaKeywordTag_NullHtmlDoc_ThrowsException()
        {
            Action act = () => _sut.GetMetaKeywordTag(null);

            act.Should().Throw <Exception>();
        }