public void SuccessCountProperty_OnSet_SetsTheValue() { var pageScore = new PageScore(); pageScore.SuccessCount = 100; Assert.AreEqual(100, pageScore.SuccessCount); }
public void OverallScoreProperty_OnSet_SetsTheValue() { var pageScore = new PageScore(); pageScore.OverallScore = 100; Assert.AreEqual(100, pageScore.OverallScore); }
private int CalculateScore(Analysis analysis, PageScore pageScore) { var totalScore = 0; foreach (var result in analysis.Results) { pageScore.ErrorCount += result.ErrorCount; pageScore.WarningCount += result.WarningCount; pageScore.HintCount += result.HintCount; pageScore.SuccessCount += result.SuccessCount; result.Score = GetResultScore(result); totalScore += result.Score; } return(totalScore); }
/// <summary> /// Gets the score for a category. /// </summary> /// <param name="pageAnalysis">The page analysis.</param> /// <returns></returns> public PageScore GetScore(PageAnalysis pageAnalysis) { var pageScore = new PageScore(); var totalScore = 0; foreach (var analyzerResult in pageAnalysis.AnalyzerResults) { totalScore += CalculateScore(analyzerResult.Analysis, pageScore); } var numberOfAnalyzers = pageAnalysis.AnalyzerResults.Sum(x => x.Analysis.Results.Count); pageScore.OverallScore = totalScore / numberOfAnalyzers; return(pageScore); }
private PageScore CalculatePageScore(IEnumerable <AnalyzeResult> analyzers) { var pageScore = new PageScore { ErrorCount = analyzers.Sum(x => x.ErrorCount), WarningCount = analyzers.Sum(x => x.WarningCount), HintCount = analyzers.Sum(x => x.HintCount), SuccessCount = analyzers.Sum(x => x.SuccessCount) }; var totalScore = analyzers.Sum(CalculateResultScore); var totalWeight = analyzers.Sum(x => x.Weight); pageScore.OverallScore = CalculateOverallScore(totalScore, totalWeight); return(pageScore); }
public PageScore GetScore(PageAnalysis pageAnalysis) { var pageScore = new PageScore(); var totalScore = 0; foreach (var analyzerResult in pageAnalysis.AnalyzerResults) { var analysis = analyzerResult.Analysis; foreach (var result in analysis.Results) { pageScore.ErrorCount += result.ErrorCount; pageScore.WarningCount += result.WarningCount; pageScore.HintCount += result.HintCount; pageScore.SuccessCount += result.SuccessCount; result.Score = GetResultScore(result); totalScore += result.Score; } } pageScore.OverallScore = totalScore / pageAnalysis.AnalyzerResults.Sum(x => x.Analysis.Results.Count); return(pageScore); }
public string Serialize(PageScore score) { return(base.Serialize(score)); }