コード例 #1
0
        /// <inheritdoc/>
        public string GetDescription(Comparison difference)
        {
            ComparisonType type        = difference.Type;
            string         description = type.GetDescription();

            Comparison.Detail controlDetails = difference.ControlDetails;
            Comparison.Detail testDetails    = difference.TestDetails;
            string            controlTarget  = GetShortString(controlDetails.Target,
                                                              controlDetails.XPath, type);
            string testTarget = GetShortString(testDetails.Target,
                                               testDetails.XPath, type);

            if (type == ComparisonType.ATTR_NAME_LOOKUP)
            {
                return(string.Format("Expected {0} '{1}' - comparing {2} to {3}",
                                     description,
                                     controlDetails.XPath,
                                     controlTarget, testTarget));
            }
            return(string.Format("Expected {0} '{1}' but was '{2}' - comparing {3} to {4}",
                                 description,
                                 GetValue(controlDetails.Value, type),
                                 GetValue(testDetails.Value, type),
                                 controlTarget, testTarget));
        }
コード例 #2
0
        /// <summary>
        /// Format of the error message.
        /// </summary>
        /// <param name="displayName">Property display name.</param>
        /// <param name="otherDisplayName">Other property display name.</param>
        /// <returns>The formatted error message.</returns>
        public string FormatErrorMessage(string displayName, string otherDisplayName)
        {
            if (string.IsNullOrEmpty(ErrorMessageResourceName) && string.IsNullOrEmpty(ErrorMessage))
            {
                ErrorMessage = DefaultErrorMessageFormatString;
            }

            return(string.Format(ErrorMessageString, displayName, ComparisonType.GetDescription(), otherDisplayName));
        }
コード例 #3
0
ファイル: FilterNumberRange.cs プロジェクト: LeonSutedja/Shop
 public override string ToString()
 {
     return(ComparisonType.GetDescription() + " From: " + From + " To: " + To);
 }