public override AnalyzeResult Analyse(IPageData pageData)
        {
            var result = new AnalyzeResult();

            var headTag = _htmlTagHelper.GetHeadTag(pageData.Document, result);

            if (headTag != null)
            {
                AnalyzeHeadTag(headTag, result);
            }

            return(result);
        }
Beispiel #2
0
        public void GetHeadTag_OnExecuteWithMultipleHeadTags_ThrowsException()
        {
            var doc = new HtmlDocument();

            doc.LoadHtml("<html><head><title>Title</title></head><head><title>Title</title></head></html>");

            var htmlTagHelper = new HtmlTagHelper();

            htmlTagHelper.GetHeadTag(doc.DocumentNode);
        }
Beispiel #3
0
        public void GetHeadTag_OnExecuteWithHeadTag_ReturnsTheHeadNode()
        {
            var doc = new HtmlDocument();

            doc.LoadHtml("<html><head><title>Title</title></head></html>");

            var htmlTagHelper = new HtmlTagHelper();
            var headTag       = htmlTagHelper.GetHeadTag(doc.DocumentNode);

            Assert.IsNotNull(headTag);
            Assert.AreEqual("<title>Title</title>", headTag.InnerHtml);
        }
Beispiel #4
0
        public void GetHeadTag_OnExecuteWithNullParameter_ThrowsException()
        {
            var htmlTagHelper = new HtmlTagHelper();

            htmlTagHelper.GetHeadTag(null);
        }