diff options
author | 杨宇千 <crupest@outlook.com> | 2019-08-04 15:02:58 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-08-04 15:02:58 +0800 |
commit | a17aa8770b0b4861849c6e01812b2ff686497f02 (patch) | |
tree | 6d1afc3dbe3b91122a1c95ace2aafee76967e230 /Timeline.Tests/Helpers/ResponseExtensions.cs | |
parent | c1586e28e44835b3636fb63e31f613de4a30bc1e (diff) | |
download | timeline-a17aa8770b0b4861849c6e01812b2ff686497f02.tar.gz timeline-a17aa8770b0b4861849c6e01812b2ff686497f02.tar.bz2 timeline-a17aa8770b0b4861849c6e01812b2ff686497f02.zip |
Add unit tests for token.
Diffstat (limited to 'Timeline.Tests/Helpers/ResponseExtensions.cs')
-rw-r--r-- | Timeline.Tests/Helpers/ResponseExtensions.cs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Timeline.Tests/Helpers/ResponseExtensions.cs b/Timeline.Tests/Helpers/ResponseExtensions.cs new file mode 100644 index 00000000..86ac1c88 --- /dev/null +++ b/Timeline.Tests/Helpers/ResponseExtensions.cs @@ -0,0 +1,14 @@ +using Newtonsoft.Json; +using System.Net.Http; +using System.Threading.Tasks; + +namespace Timeline.Tests.Helpers +{ + public static class ResponseExtensions + { + public static async Task<T> ReadBodyAsJson<T>(this HttpResponseMessage response) + { + return JsonConvert.DeserializeObject<T>(await response.Content.ReadAsStringAsync()); + } + } +} |