aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline.Tests/IntegratedTests/HttpClientTestExtensions.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-11-15 02:28:10 +0800
committercrupest <crupest@outlook.com>2020-11-15 02:28:10 +0800
commit67fff3b0883ffaf2a2b314252412e5476413bbf0 (patch)
tree325d9dee86e9b243ff0d6e36ed371f0f25b766c5 /BackEnd/Timeline.Tests/IntegratedTests/HttpClientTestExtensions.cs
parentf5ccd0d9855f82e14c6b765eee6a04b22c50dc8a (diff)
downloadtimeline-67fff3b0883ffaf2a2b314252412e5476413bbf0.tar.gz
timeline-67fff3b0883ffaf2a2b314252412e5476413bbf0.tar.bz2
timeline-67fff3b0883ffaf2a2b314252412e5476413bbf0.zip
...
Diffstat (limited to 'BackEnd/Timeline.Tests/IntegratedTests/HttpClientTestExtensions.cs')
-rw-r--r--BackEnd/Timeline.Tests/IntegratedTests/HttpClientTestExtensions.cs13
1 files changed, 9 insertions, 4 deletions
diff --git a/BackEnd/Timeline.Tests/IntegratedTests/HttpClientTestExtensions.cs b/BackEnd/Timeline.Tests/IntegratedTests/HttpClientTestExtensions.cs
index 18334622..5091a7f7 100644
--- a/BackEnd/Timeline.Tests/IntegratedTests/HttpClientTestExtensions.cs
+++ b/BackEnd/Timeline.Tests/IntegratedTests/HttpClientTestExtensions.cs
@@ -48,14 +48,14 @@ namespace Timeline.Tests.IntegratedTests
return resBody;
}
- public static async Task TestGetAsync(this HttpClient client, string url, HttpStatusCode expectedStatusCode = HttpStatusCode.OK)
+ public static async Task TestGetAsync(this HttpClient client, string url, HttpStatusCode expectedStatusCode = HttpStatusCode.OK, HeaderSetup? headerSetup = null)
{
- await client.TestJsonSendAsync(HttpMethod.Get, url, expectedStatusCode: expectedStatusCode);
+ await client.TestJsonSendAsync(HttpMethod.Get, url, expectedStatusCode: expectedStatusCode, headerSetup: headerSetup);
}
- public static async Task<T> TestGetAsync<T>(this HttpClient client, string url, HttpStatusCode expectedStatusCode = HttpStatusCode.OK)
+ public static async Task<T> TestGetAsync<T>(this HttpClient client, string url, HttpStatusCode expectedStatusCode = HttpStatusCode.OK, HeaderSetup? headerSetup = null)
{
- return await client.TestJsonSendAsync<T>(HttpMethod.Get, url, expectedStatusCode: expectedStatusCode);
+ return await client.TestJsonSendAsync<T>(HttpMethod.Get, url, expectedStatusCode: expectedStatusCode, headerSetup: headerSetup);
}
public static async Task TestPostAsync(this HttpClient client, string url, object? jsonBody = null, HttpStatusCode expectedStatusCode = HttpStatusCode.OK)
@@ -106,6 +106,11 @@ namespace Timeline.Tests.IntegratedTests
await client.TestSendAssertErrorAsync(method, url, reqContent, expectedStatusCode, errorCode, headerSetup);
}
+ public static async Task TestGetAssertErrorAsync(this HttpClient client, string url, object? jsonBody = null, HttpStatusCode expectedStatusCode = HttpStatusCode.BadRequest, int? errorCode = null, HeaderSetup? headerSetup = null)
+ {
+ await client.TestJsonSendAssertErrorAsync(HttpMethod.Get, url, jsonBody, expectedStatusCode, errorCode, headerSetup);
+ }
+
public static async Task TestPostAssertErrorAsync(this HttpClient client, string url, object? jsonBody = null, HttpStatusCode expectedStatusCode = HttpStatusCode.BadRequest, int? errorCode = null, HeaderSetup? headerSetup = null)
{
await client.TestJsonSendAssertErrorAsync(HttpMethod.Post, url, jsonBody, expectedStatusCode, errorCode, headerSetup);