Ejemplo n.º 1
0
        public void GetMetaNodesCollection_ValidHtml_ReturnHtmlNodeCollection()
        {
            var htmlDocument   = HtmlAgilityPackHelper.RetrieveHtml(ValidUrl);
            var nodeCollection = HtmlAgilityPackHelper.GetMetaNodesCollection(htmlDocument);

            Assert.IsNotNull(nodeCollection);
        }
Ejemplo n.º 2
0
        public void GetMetaNodesCollection_InvalidHtml_ReturnNull()
        {
            var htmlDocument   = new HtmlDocument();
            var nodeCollection = HtmlAgilityPackHelper.GetMetaNodesCollection(htmlDocument);

            Assert.IsNull(nodeCollection);
        }
Ejemplo n.º 3
0
        private List <string> GetKeywordsFromUrl(string url)
        {
            if (!IsUrlValid(url))
            {
                return(null);
            }

            var htmlDocument = HtmlAgilityPackHelper.RetrieveHtml(url);
            var metaNodes    = HtmlAgilityPackHelper.GetMetaNodesCollection(htmlDocument);

            return(GetKeywordsFromMetaNodes(metaNodes));
        }