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 | 05f10e61506c4c9200a863d3f060a480d897f4d4 (patch) | |
tree | 6d1afc3dbe3b91122a1c95ace2aafee76967e230 /Timeline.Tests/Helpers/ResponseExtensions.cs | |
parent | 13f0a95397751783ac0b4dcfa4d8f1b7112de04c (diff) | |
download | timeline-05f10e61506c4c9200a863d3f060a480d897f4d4.tar.gz timeline-05f10e61506c4c9200a863d3f060a480d897f4d4.tar.bz2 timeline-05f10e61506c4c9200a863d3f060a480d897f4d4.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()); + } + } +} |