From 5e0ad225efd9627fa99509a1fdf3ed07672c8bda Mon Sep 17 00:00:00 2001 From: 杨宇千 Date: Fri, 9 Aug 2019 15:39:58 +0800 Subject: Add UserController unit tests. --- Timeline.Tests/Helpers/HttpClientExtensions.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Timeline.Tests/Helpers/HttpClientExtensions.cs (limited to 'Timeline.Tests/Helpers/HttpClientExtensions.cs') 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 PatchAsJsonAsync(this HttpClient client, string url, T body) + { + return client.PatchAsync(url, new StringContent(JsonConvert.SerializeObject(body), Encoding.UTF8, "application/json")); + } + } +} -- cgit v1.2.3