Example #1
0
        public static void CompareToBaseLine(string baselinefilePath, string actual)
        {
            var expected = File.ReadAllText(baselinefilePath);

            // Trim whitescpase in the end to avoid false positives b/c file
            // has extra line break or whitespace at the end.
            expected = expected.TrimEnd(_whitespace);
            actual   = actual.TrimEnd(_whitespace);

            var lineNumber = BaselineCompare.CompareLines(expected, actual, out var baseLine, out var actualLine, out var index);

            lineNumber.Should().Be(0, "there should be no difference at line {0}.\r\nExpected:{1}\r\nActual:{2}\r\nDifference at position {3}\r\n", lineNumber, baseLine, actualLine, index);
        }
Example #2
0
        public static void CompareToBaseLine(string baselinefilePath, string actual)
        {
            var expected = File.ReadAllText(baselinefilePath);

            // Trim whitescpase in the end to avoid false positives b/c file
            // has extra line break or whitespace at the end.
            expected = expected.TrimEnd(_whitespace);
            actual   = actual.TrimEnd(_whitespace);

            var lineNumber = BaselineCompare.CompareLines(expected, actual, out var baseLine, out var actualLine, out var index);

            if (lineNumber > 0)
            {
                actualLine.Should().Be(baseLine);
            }
        }
Example #3
0
        public static void CompareToBaseLine(string baselinefilePath, string actual)
        {
            string expected;

            using (var streamReader = new StreamReader(baselinefilePath)) {
                expected = streamReader.ReadToEnd();
            }

            // trim whitescpase in the end to avoid false positives b/c file
            // has extra line break or whitespace at the end.
            expected = expected.TrimEnd(' ', '\r', '\n', '\t');
            actual   = actual.TrimEnd(' ', '\r', '\n', '\t');

            string baseLine;
            string actualLine;
            int    index;
            var    lineNumber = BaselineCompare.CompareLines(expected, actual, out baseLine, out actualLine, out index);

            lineNumber.Should().Be(0, "there should be no difference at line {0}.\r\nExpected:{1}\r\nActual:{2}\r\nDifference at position {3}\r\n", lineNumber, baseLine, actualLine, index);
        }