You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- *Enhancement:* Extended the `MockHttpClientResponse.With*` methods to support optional _media type_ parameter to enable specification of the `Content-Type` header value.
- *Enhancement:* Added `HttpResponseMessageAssertor.AssertContentTypeProblemJson` to enable asserting that the content type is `application/problem+json`.
- *Fixed:* `HttpResponseMessageAssertor<TValue>.Value` no longer asserts the content type as `application/json` by default as this could not be overridden; this should be asserted explicitly using `AssertContentType()`, `AssertContentTypeJson()`, `AssertContentTypeProblemJson`, etc.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,11 @@
2
2
3
3
Represents the **NuGet** versions.
4
4
5
+
## v5.8.0
6
+
-*Enhancement:* Extended the `MockHttpClientResponse.With*` methods to support optional _media type_ parameter to enable specification of the `Content-Type` header value.
7
+
-*Enhancement:* Added `HttpResponseMessageAssertor.AssertContentTypeProblemJson` to enable asserting that the content type is `application/problem+json`.
8
+
-*Fixed:*`HttpResponseMessageAssertor<TValue>.Value` no longer asserts the content type as `application/json` by default as this could not be overridden; this should be asserted explicitly using `AssertContentType()`, `AssertContentTypeJson()`, `AssertContentTypeProblemJson`, etc.
9
+
5
10
## v5.7.0
6
11
-*Enhancement:* Added `.NET10.0` support to all `UnitTestEx` packages.
7
12
-*Enhancement:* Added `AssertNoNamedHeader` to the `HttpResponseMessageAssertor` to enable asserting that a named header is not present in the response.
/// Gets the response content as the deserialized JSON value.
40
40
/// </summary>
41
41
/// <returns>The result value.</returns>
42
+
/// <remarks>The corresponding content type is not asserted, where this is required then <see cref="HttpResponseMessageAssertorBase.GetValue{T}(string?)"/> should be used.</remarks>
42
43
publicTValue?Value
43
44
{
44
45
get
45
46
{
46
47
if(!_valueIsDeserialized)
47
48
{
48
-
_value=GetValue<TValue>();
49
+
_value=GetValue<TValue>(null);
49
50
_valueIsDeserialized=true;
50
51
}
51
52
@@ -60,7 +61,7 @@ public TValue? Value
60
61
/// <returns>The <see cref="HttpResponseMessageAssertor{TValue}"/> to support fluent-style method-chaining.</returns>
Implementor.AssertAreEqual(expected?.Invoke(GetValue<TValue>()),Response.Headers?.Location?.ToString(),$"Expected and Actual HTTP Response Header '{HeaderNames.Location}' values are not equal.");
64
+
Implementor.AssertAreEqual(expected?.Invoke(Value),Response.Headers?.Location?.ToString(),$"Expected and Actual HTTP Response Header '{HeaderNames.Location}' values are not equal.");
64
65
returnthis;
65
66
}
66
67
@@ -71,7 +72,7 @@ public HttpResponseMessageAssertor<TValue> AssertLocationHeader(Func<TValue?, st
71
72
/// <returns>The <see cref="HttpResponseMessageAssertor{TValue}"/> to support fluent-style method-chaining.</returns>
Implementor.AssertAreEqual(expectedUri?.Invoke(GetValue<TValue>()),Response.Headers?.Location,$"Expected and Actual HTTP Response Header '{HeaderNames.Location}' values are not equal.");
75
+
Implementor.AssertAreEqual(expectedUri?.Invoke(Value),Response.Headers?.Location,$"Expected and Actual HTTP Response Header '{HeaderNames.Location}' values are not equal.");
75
76
returnthis;
76
77
}
77
78
@@ -100,7 +101,7 @@ public HttpResponseMessageAssertor<TValue> AssertLocationHeaderContains(string e
/// Provides the mocked response using the JSON formatted embedded resource string as the content.
226
230
/// </summary>
227
231
/// <param name="resourceName">The embedded resource name (matches to the end of the fully qualifed resource name).</param>
228
232
/// <param name="statusCode">The optional <see cref="HttpStatusCode"/> (defaults to <see cref="HttpStatusCode.OK"/>).</param>
233
+
/// <param name="mediaType">The optional media type (defaults to <see cref="MediaTypeNames.Application.Json"/>).</param>
229
234
/// <param name="response">The optional action to enable additional configuration of the <see cref="HttpResponseMessage"/>.</param>
230
235
/// <param name="assembly">The <see cref="Assembly"/> that contains the embedded resource; defaults to <see cref="Assembly.GetCallingAssembly"/>.</param>
0 commit comments