Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log entire content to see which assertion fails #67586

Merged
merged 2 commits into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,17 @@ public static void AtLeastOneEquals<T>(T expected1, T expected2, T value)
throw new XunitException($"Expected: {expected1} || {expected2}{Environment.NewLine}Actual: {value}");
}

/// <summary>
/// Compares two strings, logs entire content if they are not equal.
/// </summary>
public static void Equal(string expected, string actual)
{
if (!expected.Equals(actual))
{
throw new AssertActualExpectedException(expected, actual, "Provided strings were not equal!");
}
}

public delegate void AssertThrowsActionReadOnly<T>(ReadOnlySpan<T> span);

public delegate void AssertThrowsAction<T>(Span<T> span);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void TestAsyncErrorStream_SynchronizingObject(bool invokeRequired)
p.WaitForExit(); // This ensures async event handlers are finished processing.

const string Expected = RemotelyInvokable.TestConsoleApp + " started error stream" + RemotelyInvokable.TestConsoleApp + " closed error stream";
Assert.Equal(Expected, sb.ToString());
AssertExtensions.Equal(Expected, sb.ToString());
Assert.Equal(invokeRequired ? 3 : 0, invokeCalled);
}

Expand Down