Пример #1
0
        /// <summary>
        /// Display the expected and actual string values on separate lines.
        /// If the mismatch parameter is >=0, an additional line is displayed
        /// line containing a caret that points to the mismatch point.
        /// </summary>
        /// <param name="expected">The expected string value</param>
        /// <param name="actual">The actual string value</param>
        /// <param name="mismatch">The point at which the strings don't match or -1</param>
        /// <param name="ignoreCase">If true, case is ignored in string comparisons</param>
        public override void DisplayStringDifferences(string expected, string actual, int mismatch, bool ignoreCase)
        {
            // Maximum string we can display without truncating
            int maxStringLength = MAX_LINE_LENGTH
                                  - PrefixLength // Allow for prefix
                                  - 2;           // 2 quotation marks

            expected = MsgUtils.ConvertWhitespace(MsgUtils.ClipString(expected, maxStringLength, mismatch));
            actual   = MsgUtils.ConvertWhitespace(MsgUtils.ClipString(actual, maxStringLength, mismatch));

            // The mismatch position may have changed due to clipping or white space conversion
            mismatch = MsgUtils.FindMismatchPosition(expected, actual, 0, ignoreCase);

            DisplayDifferences(expected, actual);
            if (mismatch >= 0)
            {
                WriteCaretLine(mismatch);
            }
        }
Пример #2
0
 /// <summary>Returns a string that represents the current object.</summary>
 public override string ToString()
 {
     return($"{MsgUtils.FormatValue(_from)} .. {MsgUtils.FormatValue(_step)} .. {MsgUtils.FormatValue(_to)}");
 }