Skip to content

Commit 0e4d814

Browse files
committed
diagnose test failure
1 parent bd4cbc4 commit 0e4d814

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

src/Common/test/TestResources/FluentAssertionsExtensions.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,10 @@ public static class FluentAssertionsExtensions
1818
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
1919
};
2020

21-
/// <summary>
22-
/// Asserts that a JSON-formatted string matches the specified JSON text, ignoring differences in insignificant whitespace and line endings. Using this
23-
/// extension enables writing assertions on JSON in a more readable fashion.
24-
/// </summary>
25-
/// <param name="source">
26-
/// The source JSON to assert on.
27-
/// </param>
28-
/// <param name="expected">
29-
/// The expected JSON text.
30-
/// </param>
3121
[CustomAssertion]
32-
public static void BeJson(this StringAssertions source, string expected)
22+
#pragma warning disable S2360 // Optional parameters should not be used
23+
public static void BeJson(this StringAssertions source, string expected, string? because = null)
24+
#pragma warning restore S2360 // Optional parameters should not be used
3325
{
3426
ArgumentNullException.ThrowIfNull(source);
3527
ArgumentNullException.ThrowIfNull(expected);
@@ -40,7 +32,7 @@ public static void BeJson(this StringAssertions source, string expected)
4032
string sourceText = ToJsonString(sourceJson);
4133
string expectedText = ToJsonString(expectedJson);
4234

43-
sourceText.Should().Be(expectedText);
35+
sourceText.Should().Be(expectedText, because);
4436
}
4537

4638
private static string ToJsonString(JsonDocument document)

src/Management/test/Endpoint.Test/Actuators/Info/InfoActuatorTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public async Task Endpoint_returns_expected_data(HostBuilderType hostBuilderType
174174
"version": "{{AppFileVersion}}"
175175
}
176176
}
177-
""");
177+
""", responseBody);
178178
}
179179

180180
[Fact]

0 commit comments

Comments
 (0)