Ejemplo n.º 1
0
 public ReportComparer(List <DifferenceAndCount> knownDifferences)
 {
     this.results = new List <DealDifferences>();
     this.dealDifferenceSummaries = new DealDifferenceSummaries(knownDifferences);
 }
Ejemplo n.º 2
0
        private static ComparisonListener DiffListener(List <DifferenceAndXPath> results, DealDifferenceSummaries dealDifferenceSummaries)
        {
            return((comparison, outcome) =>
            {
                string difference;
                if (comparison.Type == ComparisonType.TEXT_VALUE || comparison.Type == ComparisonType.CHILD_LOOKUP)
                {
                    var rh1XML = comparison.ControlDetails?.Target?.OuterXml;
                    var rh2XML = comparison.TestDetails?.Target?.OuterXml;

                    difference = $"RH1 {rh1XML} || RH2: {rh2XML}";
                }
                else if (comparison.Type == ComparisonType.CHILD_NODELIST_LENGTH || comparison.Type == ComparisonType.CHILD_NODELIST_SEQUENCE)
                {
                    difference = string.Empty;
                }
                else
                {
                    difference = comparison.ToString();
                }

                difference = difference.Replace(",", " comma ");

                if (!string.IsNullOrEmpty(difference))
                {
                    dealDifferenceSummaries.AddError(difference);

                    results.Add(new DifferenceAndXPath()
                    {
                        Difference = difference,
                        ComparisonXPath = comparison.ControlDetails?.XPath,
                        TargetXPath = comparison.TestDetails?.XPath
                    });
                }
            });
        }