diff --git a/src/TestFramework/TestFramework/Assertions/Assert.AreEqual.cs b/src/TestFramework/TestFramework/Assertions/Assert.AreEqual.cs index 56a1a18b02..fcb4b1b364 100644 --- a/src/TestFramework/TestFramework/Assertions/Assert.AreEqual.cs +++ b/src/TestFramework/TestFramework/Assertions/Assert.AreEqual.cs @@ -293,7 +293,7 @@ private static void ReportAssertAreEqualFailed(object? expected, object? actual, structured.WithUserMessage(message); structured.WithEvidence(evidence); structured.WithExpectedAndActual(expectedRendered, actualRendered); - structured.WithCallSiteExpression(FormatBinaryCallSiteExpression("Assert.AreEqual", expectedExpression, "expected", actualExpression, "actual")); + structured.WithCallSiteExpression(FormatCallSiteExpression("Assert.AreEqual", expectedExpression, actualExpression, "", "")); ReportAssertFailed(structured); } @@ -414,7 +414,7 @@ private static void ReportAssertAreNotEqualFailed(object? notExpected, object? a structured.WithUserMessage(message); structured.WithEvidence(evidence); structured.WithExpectedAndActual($"not {notExpectedRendered}", actualRendered); - structured.WithCallSiteExpression(FormatBinaryCallSiteExpression("Assert.AreNotEqual", notExpectedExpression, "notExpected", actualExpression, "actual")); + structured.WithCallSiteExpression(FormatCallSiteExpression("Assert.AreNotEqual", notExpectedExpression, actualExpression, "", "")); ReportAssertFailed(structured); } diff --git a/src/TestFramework/TestFramework/Assertions/Assert.cs b/src/TestFramework/TestFramework/Assertions/Assert.cs index fa3a3dc428..b3c20de7f0 100644 --- a/src/TestFramework/TestFramework/Assertions/Assert.cs +++ b/src/TestFramework/TestFramework/Assertions/Assert.cs @@ -314,26 +314,6 @@ internal static string ReplaceNulls(object? input) ? null : $"{methodName}({expression})"; - private static readonly char[] LineBreakChars = ['\n', '\r']; - - /// - /// Formats a call-site expression like Assert.MethodName(expression1, expression2). - /// When either expression is empty the call-site is omitted. When an expression contains - /// newlines (multiline constant) it is replaced with a <paramName> placeholder. - /// - private static string? FormatBinaryCallSiteExpression(string methodName, string expression1, string paramName1, string expression2, string paramName2) - { - if (string.IsNullOrWhiteSpace(expression1) || string.IsNullOrWhiteSpace(expression2)) - { - return null; - } - - string arg1 = expression1.IndexOfAny(LineBreakChars) >= 0 ? $"<{paramName1}>" : expression1; - string arg2 = expression2.IndexOfAny(LineBreakChars) >= 0 ? $"<{paramName2}>" : expression2; - - return $"{methodName}({arg1}, {arg2})"; - } - private static int CompareInternal(string? expected, string? actual, bool ignoreCase, CultureInfo culture) #pragma warning disable CA1309 // Use ordinal string comparison => string.Compare(expected, actual, ignoreCase, culture);