예제 #1
0
        public Analysis GetAnalysis()
        {
            var analysis = new Analysis();

            var titleAnalyzer = new TitleAnalyzer();

            analysis.Results.Add(titleAnalyzer.Analyse(_htmlResult.Document));

            var metaDescriptionAnalyzer = new MetaDescriptionAnalyzer();

            analysis.Results.Add(metaDescriptionAnalyzer.Analyse(_htmlResult.Document));

            var metaKeywordAnalyzer = new MetaKeywordAnalyzer();

            analysis.Results.Add(metaKeywordAnalyzer.Analyse(_htmlResult.Document));

            var imagesAnalyzer = new ImageTagAnalyzer();

            analysis.Results.Add(imagesAnalyzer.Analyse(_htmlResult.Document));

            var anchorAnalyzer = new AnchorTagAnalyzer();

            analysis.Results.Add(anchorAnalyzer.Analyse(_htmlResult.Document));

            var deprecatedTagAnalyzer = new DeprecatedTagAnalyzer();

            analysis.Results.Add(deprecatedTagAnalyzer.Analyse(_htmlResult.Document));

            var metaRobotsAnalyzer = new MetaRobotsAnalyzer();

            analysis.Results.Add(metaRobotsAnalyzer.Analyse(_htmlResult.Document));

            return(analysis);
        }
예제 #2
0
        public void Analyse_OnExecuteWithNoDeprecatedTag_SetsResult()
        {
            var analyzer = new DeprecatedTagAnalyzer(new OptionHelper());

            var doc = new HtmlDocument();

            doc.LoadHtml("<body><div>focus</div></body>");

            var pageData = new PageData()
            {
                Document = doc.DocumentNode
            };

            analyzer.Analyse(pageData);
            var result = analyzer.AnalyzeResult;

            Assert.IsNotNull(result);
            Assert.IsTrue(result.ResultRules.Count == 1);
            Assert.AreEqual(ResultType.Success, result.ResultRules.First().Type);
            Assert.AreEqual("no_deprecated_tags_found", result.ResultRules.First().Alias);
        }
예제 #3
0
        public void Analyse_OnExecuteWithNullParameter_ThrowArgumentNullException()
        {
            var analyzer = new DeprecatedTagAnalyzer(new OptionHelper());

            analyzer.Analyse(null);
        }