Beispiel #1
0
        private bool ControlHasOneTextChildAndTestHasNone(Comparison comparison)
        {
            Comparison.Detail controlDetails = comparison.ControlDetails;
            XmlNode           controlTarget  = controlDetails.Target;

            Comparison.Detail testDetails = comparison.TestDetails;
            return(comparison.Type == ComparisonType.CHILD_NODELIST_LENGTH &&
                   1 == (int)controlDetails.Value &&
                   0 == (int)testDetails.Value &&
                   IsTextLikeNode(controlTarget.FirstChild));
        }
Beispiel #2
0
        /// <summary>
        ///   DifferenceEvaluator using the configured PlaceholderHandlers.
        /// </summary>
        public ComparisonResult Evaluate(Comparison comparison, ComparisonResult outcome)
        {
            if (outcome == ComparisonResult.EQUAL)
            {
                return(outcome);
            }

            Comparison.Detail controlDetails = comparison.ControlDetails;
            XmlNode           controlTarget  = controlDetails.Target;

            Comparison.Detail testDetails = comparison.TestDetails;
            XmlNode           testTarget  = testDetails.Target;

            // comparing textual content of elements
            if (comparison.Type == ComparisonType.TEXT_VALUE)
            {
                return(EvaluateConsideringPlaceholders((string)controlDetails.Value,
                                                       (string)testDetails.Value, outcome));

                // "test document has no text-like child node but control document has"
            }
            else if (IsMissingTextNodeDifference(comparison))
            {
                return(EvaluateMissingTextNodeConsideringPlaceholders(comparison, outcome));

                // may be comparing TEXT to CDATA
            }
            else if (IsTextCDATAMismatch(comparison))
            {
                return(EvaluateConsideringPlaceholders(controlTarget.Value, testTarget.Value, outcome));

                // comparing textual content of attributes
            }
            else if (comparison.Type == ComparisonType.ATTR_VALUE)
            {
                return(EvaluateConsideringPlaceholders((string)controlDetails.Value,
                                                       (string)testDetails.Value, outcome));

                // "test document has no attribute but control document has"
            }
            else if (IsMissingAttributeDifference(comparison))
            {
                return(EvaluateMissingAttributeConsideringPlaceholders(comparison, outcome));
            }

            // default, don't apply any placeholders at all
            return(outcome);
        }
Beispiel #3
0
 private string GetDetails(Comparison.Detail detail, ComparisonType type)
 {
     return(comparisonFormatter.GetDetails(detail, type, formatXml));
 }
Beispiel #4
0
 public string GetDetails(Comparison.Detail details, ComparisonType type, bool formatXml)
 {
     return("DETAIL-" + details.Value);
 }
Beispiel #5
0
 public string GetDetails(Comparison.Detail details, ComparisonType type,
                          bool formatXml)
 {
     return("bar");
 }