diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/internal/WixBuildTools.TestSupport/WixAssert.cs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/internal/WixBuildTools.TestSupport/WixAssert.cs b/src/internal/WixBuildTools.TestSupport/WixAssert.cs index 938902ec..6d14bc89 100644 --- a/src/internal/WixBuildTools.TestSupport/WixAssert.cs +++ b/src/internal/WixBuildTools.TestSupport/WixAssert.cs | |||
| @@ -12,13 +12,17 @@ namespace WixBuildTools.TestSupport | |||
| 12 | { | 12 | { |
| 13 | public static void CompareLineByLine(string[] expectedLines, string[] actualLines) | 13 | public static void CompareLineByLine(string[] expectedLines, string[] actualLines) |
| 14 | { | 14 | { |
| 15 | for (var i = 0; i < expectedLines.Length; ++i) | 15 | var lineNumber = 0; |
| 16 | |||
| 17 | for (; lineNumber < expectedLines.Length && lineNumber < actualLines.Length; ++lineNumber) | ||
| 16 | { | 18 | { |
| 17 | Assert.True(actualLines.Length > i, $"{i}: expectedLines longer than actualLines"); | 19 | WixAssert.StringEqual($"{lineNumber}: {expectedLines[lineNumber]}", $"{lineNumber}: {actualLines[lineNumber]}"); |
| 18 | WixAssert.StringEqual($"{i}: {expectedLines[i]}", $"{i}: {actualLines[i]}"); | ||
| 19 | } | 20 | } |
| 20 | 21 | ||
| 21 | Assert.True(expectedLines.Length == actualLines.Length, $"actualLines ({actualLines.Length}) longer than expectedLines ({expectedLines.Length})"); | 22 | var additionalExpectedLines = expectedLines.Length > lineNumber ? String.Join(Environment.NewLine, expectedLines.Skip(lineNumber).Select((s, i) => $"{lineNumber + i}: {s}")) : $"Missing {actualLines.Length - lineNumber} lines"; |
| 23 | var additionalActualLines = actualLines.Length > lineNumber ? String.Join(Environment.NewLine, actualLines.Skip(lineNumber).Select((s, i) => $"{lineNumber + i}: {s}")) : $"Missing {expectedLines.Length - lineNumber} lines"; | ||
| 24 | |||
| 25 | WixAssert.StringEqual(additionalExpectedLines, additionalActualLines); | ||
| 22 | } | 26 | } |
| 23 | 27 | ||
| 24 | public static void CompareXml(XContainer xExpected, XContainer xActual) | 28 | public static void CompareXml(XContainer xExpected, XContainer xActual) |
| @@ -70,21 +74,21 @@ namespace WixBuildTools.TestSupport | |||
| 70 | public static readonly StringObjectEqualityComparer InvariantCultureIgnoreCase = new StringObjectEqualityComparer(true); | 74 | public static readonly StringObjectEqualityComparer InvariantCultureIgnoreCase = new StringObjectEqualityComparer(true); |
| 71 | public static readonly StringObjectEqualityComparer InvariantCulture = new StringObjectEqualityComparer(false); | 75 | public static readonly StringObjectEqualityComparer InvariantCulture = new StringObjectEqualityComparer(false); |
| 72 | 76 | ||
| 73 | private readonly StringComparer _stringComparer; | 77 | private readonly StringComparer stringComparer; |
| 74 | 78 | ||
| 75 | public StringObjectEqualityComparer(bool ignoreCase) | 79 | public StringObjectEqualityComparer(bool ignoreCase) |
| 76 | { | 80 | { |
| 77 | this._stringComparer = ignoreCase ? StringComparer.InvariantCultureIgnoreCase : StringComparer.InvariantCulture; | 81 | this.stringComparer = ignoreCase ? StringComparer.InvariantCultureIgnoreCase : StringComparer.InvariantCulture; |
| 78 | } | 82 | } |
| 79 | 83 | ||
| 80 | public new bool Equals(object x, object y) | 84 | public new bool Equals(object x, object y) |
| 81 | { | 85 | { |
| 82 | return this._stringComparer.Equals((string)x,(string)y); | 86 | return this.stringComparer.Equals((string)x,(string)y); |
| 83 | } | 87 | } |
| 84 | 88 | ||
| 85 | public int GetHashCode(object obj) | 89 | public int GetHashCode(object obj) |
| 86 | { | 90 | { |
| 87 | return this._stringComparer.GetHashCode((string)obj); | 91 | return this.stringComparer.GetHashCode((string)obj); |
| 88 | } | 92 | } |
| 89 | } | 93 | } |
| 90 | } | 94 | } |
