public string BuildEvidenceForHTML()
        {
            var resultEvidence = new StringBuilder();

            resultEvidence.AppendLine(WebElementBuilder.FormatAndEncapsulateParagraph(bonusEvidence));
            resultEvidence.AppendLine(WebElementBuilder.FormatParagraph("User Interface Screenshot: "
                                                                        + Environment.NewLine + WebElementBuilder.FormatImageElement(ScreenShot)));
            return(resultEvidence.ToString());
        }
예제 #2
0
        public void AddFeature(FeatureData data)
        {
            var featureResults = new StringBuilder();

            featureResults.Append(WebElementBuilder.FormatParagraph(data.featureResult));
            featureResults.Append(data.featureEvidence.BuildEvidenceForHTML());
            string featureTitle;

            switch (data.featurePass)
            {
            case true:
                featureTitle = WebElementBuilder.FormatPassedFeatureTitle(new WebTitleElements()
                {
                    score     = data.score + "%",
                    rawScore  = data.rawScore + "%",
                    weighting = data.weighting.ToString(),
                    title     = data.title,
                });
                break;

            case false:
                featureTitle = WebElementBuilder.FormatFailedFeatureTitle(new WebTitleElements()
                {
                    score     = data.score + "%",
                    rawScore  = data.rawScore + "%",
                    weighting = data.weighting.ToString(),
                    title     = data.title,
                });
                break;

            default:
                const char dash = (char)0x2013;
                featureTitle = WebElementBuilder.FormatInconclusiveFeatureTitle(new WebTitleElements()
                {
                    score     = dash.ToString(),
                    rawScore  = dash.ToString(),
                    weighting = dash.ToString(),
                    title     = data.title,
                });
                break;
            }

            features.Append(WebElementBuilder.FormatAccordionElement(new WebAccordionData()
            {
                featureTitle  = featureTitle,
                content       = featureResults.ToString(),
                helperMessage = data.featureHelperMessage,
            }));
        }
        public string BuildEvidenceForHTML()
        {
            var evidence = new StringBuilder();

            foreach (var diff in diffs)
            {
                var lineDifference = diff.LinesAdded + diff.LinesDeleted;
                evidence.AppendLine(WebElementBuilder.FormatParagraph($"{diff.Status} : {WebElementBuilder.FormatFileDiffButton(diff.Path)} = " +
                                                                      $"{lineDifference} ({diff.LinesAdded}+ and {diff.LinesDeleted}-)"));

                evidence.AppendLine(WebElementBuilder.FormatFileDiff(diff.Patch.Split("\n").ToList()));
            }
            evidence.AppendLine(WebElementBuilder.FormatParagraph(this.bonusEvidence));
            return(evidence.ToString());
        }