public Analysis GetAnalysis() { var analysis = new Analysis(); var serverResponseAnalyzer = new ServerResponseAnalyzer(); analysis.Results.Add(serverResponseAnalyzer.Analyse(_htmlResult.Document, _htmlResult.ServerResponseTime)); var gzipAnalyzer = new GZipAnalyzer(); analysis.Results.Add(gzipAnalyzer.Analyse(_htmlResult.Document, _htmlResult.Url)); var htmlSizeAnalyzer = new HtmlSizeAnalyzer(); analysis.Results.Add(htmlSizeAnalyzer.Analyse(_htmlResult.Document)); var externalCallAnalyzer = new AdditionalCallAnalyzer(); analysis.Results.Add(externalCallAnalyzer.Analyse(_htmlResult.Document)); var url = new Uri(_htmlResult.Url); var cssMinifationAnalyzer = new CssMinificationAnalyzer(); analysis.Results.Add(cssMinifationAnalyzer.Analyse(_htmlResult.Document, url)); var javascriptMinifationAnalyzer = new JavascriptMinificationAnalyzer(); analysis.Results.Add(javascriptMinifationAnalyzer.Analyse(_htmlResult.Document, url)); return(analysis); }
public void Analyse_OnExecuteWithPageUrlSetToNull_ThrowsException() { var document = new HtmlDocument(); document.LoadHtml("<link href=\"/files/unminified.css\" rel=\"stylesheet\" />"); var pageData = new PageData() { Document = document.DocumentNode }; var analyzer = new JavascriptMinificationAnalyzer(new MinificationHelper(), new CacheHelper(), new UrlHelper()); analyzer.Analyse(pageData); }
public void Analyse_OnExecuteWithNoDocuments_ReturnsSuccess() { var document = new HtmlDocument(); document.LoadHtml(""); var pageData = new PageData() { Document = document.DocumentNode, Url = "http://www.google.nl/" }; var analyzer = new JavascriptMinificationAnalyzer(new MinificationHelper(), new CacheHelper(), new UrlHelper()); 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("all_minified", result.ResultRules.First().Alias); }
public void Analyse_OnExecuteWithNullParameter_ThrowArgumentNullException() { var analyzer = new JavascriptMinificationAnalyzer(new MinificationHelper(), new CacheHelper(), new UrlHelper()); analyzer.Analyse(null); }