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
Move assertion methods from extension methods to instance methods (#323)
* Refactor tests to test methods based on the HttpRequestMessageAsserter, so that will be easier to refactor.
* Move WithHttpMethod and WithHttpVersion tests
* Deprecate HasRequestHeader and HasResponseHeader and move tests for WithHeader to HttpRequestMessageAsserter;
* Update changelog
* Rewrite tests for WithContent
* Small async improvements
* Refactor some more tests to follow same pattern
* Move several HttpRequestMessagesCheckExtensions to HttpRequestMessageAsserter and specify them on IHttpRequestMessagesCheck interface
* Replace NSubstitute with a small amount of custom mocks
* Use WithHeader implementation for WithRequestHeader and WithContentHeader
* Change WithJsonContent and WithFormUrlEncodedContent to use WithContent and WithHeader methods instead of their own implementation.
* Deprecate WithFilter on IHttpRequestMessagesCheck
Copy file name to clipboardExpand all lines: CHANGELOG.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,16 +5,24 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
7
7
## [0.12] - unplanned
8
+
### Deprecated
9
+
- The methods `WithRequestHeader` and `WithContentHeader` are deprecated, please use `WithHeader` instead.
10
+
- The `WithFilter` method is deprecated and will be made internal or be removed. If there is a specific assertion that is missing, please open an issue.
11
+
8
12
### Removed
9
13
- .NET 6.0 target, since it is no longer supported
10
14
- .NET Framework 4.6.2, 4.7.0 and 4.7.2, since these can't be tested using xUnit v3
11
15
- automatic nuget updates by dependabot, since we want to test against the lowest supported nuget version and most of the time dependabot does not choose the right package.
16
+
12
17
### Added
13
18
- Support for .NET 9.0
14
19
- Support for .NET 10.0
20
+
15
21
### Changed
16
22
- The TestableHttpMessageHandler now makes a clone of the original request, so that the original request can be disposed.
17
23
This change also makes it possible to assert the content on .NET Framework.
24
+
- The methods `WithRequestHeader` and `WithContentHeader` now work the same as `WithHeader`, this might lead to slight changes in the behavior since now the headers from both the request and the content of that request are checked.
25
+
- Moved `WithHttpMethod`, `WithRequestUri`, `WithHttpVersion`, `WithHeader` and `WithContent` from `HttpRequestMessagesCheckExtensions` to `HttpRequestMessageAsserter` and specify them on the `IHttpRequestMessagesCheck` interface.
returnhttpRequestMessage.Headers.HasHeader(headerName)||(httpRequestMessage.Contentis not null&&httpRequestMessage.Content.Headers.HasHeader(headerName));
62
42
}
63
43
64
-
/// <summary>
65
-
/// Determines whether a specific header is set on a request.
66
-
/// </summary>
67
-
/// <remarks>This method only checks headers in <see cref="HttpRequestHeaders"/></remarks>
68
-
/// <param name="httpRequestMessage">A <see cref="HttpRequestMessage"/> to check the request header on.</param>
69
-
/// <param name="headerName">The name of the header to locate on the request.</param>
70
-
/// <returns>true when the request contains a header with the specified name; otherwise, false.</returns>
returnhttpRequestMessage.Headers.HasHeader(headerName,headerValue)||(httpRequestMessage.Contentis not null&&httpRequestMessage.Content.Headers.HasHeader(headerName,headerValue));
0 commit comments