diff options
author | 杨宇千 <crupest@outlook.com> | 2019-08-09 15:39:58 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-08-09 15:39:58 +0800 |
commit | 58986da4a5bfe519af44e5834edfbe8d4651b51c (patch) | |
tree | 26432b04bb7b2b2f59b3e8170f2e37cd5ce08c57 /Timeline.Tests/Helpers/HttpClientExtensions.cs | |
parent | 6c50630c4d6576446fc2338714feaefbf28c4ed1 (diff) | |
download | timeline-58986da4a5bfe519af44e5834edfbe8d4651b51c.tar.gz timeline-58986da4a5bfe519af44e5834edfbe8d4651b51c.tar.bz2 timeline-58986da4a5bfe519af44e5834edfbe8d4651b51c.zip |
Add UserController unit tests.
Diffstat (limited to 'Timeline.Tests/Helpers/HttpClientExtensions.cs')
-rw-r--r-- | Timeline.Tests/Helpers/HttpClientExtensions.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Timeline.Tests/Helpers/HttpClientExtensions.cs b/Timeline.Tests/Helpers/HttpClientExtensions.cs new file mode 100644 index 00000000..cd40d91e --- /dev/null +++ b/Timeline.Tests/Helpers/HttpClientExtensions.cs @@ -0,0 +1,15 @@ +using Newtonsoft.Json;
+using System.Net.Http;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Timeline.Tests.Helpers
+{
+ public static class HttpClientExtensions
+ {
+ public static Task<HttpResponseMessage> PatchAsJsonAsync<T>(this HttpClient client, string url, T body)
+ {
+ return client.PatchAsync(url, new StringContent(JsonConvert.SerializeObject(body), Encoding.UTF8, "application/json"));
+ }
+ }
+}
|