diff options
author | crupest <crupest@outlook.com> | 2020-11-15 17:38:10 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-15 17:38:10 +0800 |
commit | 63ec1050dd24e4123f73e9ed757376dc8128803d (patch) | |
tree | 23ebc51a13e803450530b8469e7202121f05f822 /BackEnd/Timeline.Tests/IntegratedTests/HttpClientTimelineExtensions.cs | |
parent | 2a132acab30042f068577096f6b97f6961951b0e (diff) | |
parent | 3c1f8bc55ad6755e961e8bae0844b9d859f6afd5 (diff) | |
download | timeline-63ec1050dd24e4123f73e9ed757376dc8128803d.tar.gz timeline-63ec1050dd24e4123f73e9ed757376dc8128803d.tar.bz2 timeline-63ec1050dd24e4123f73e9ed757376dc8128803d.zip |
Merge pull request #186 from crupest/unittest
Refactor unit tests.
Diffstat (limited to 'BackEnd/Timeline.Tests/IntegratedTests/HttpClientTimelineExtensions.cs')
-rw-r--r-- | BackEnd/Timeline.Tests/IntegratedTests/HttpClientTimelineExtensions.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/BackEnd/Timeline.Tests/IntegratedTests/HttpClientTimelineExtensions.cs b/BackEnd/Timeline.Tests/IntegratedTests/HttpClientTimelineExtensions.cs new file mode 100644 index 00000000..8e48ccbf --- /dev/null +++ b/BackEnd/Timeline.Tests/IntegratedTests/HttpClientTimelineExtensions.cs @@ -0,0 +1,21 @@ +using System.Net.Http;
+using System.Threading.Tasks;
+using Timeline.Models.Http;
+
+namespace Timeline.Tests.IntegratedTests
+{
+ public static class HttpClientTimelineExtensions
+ {
+ public static Task<TimelineInfo> GetTimelineAsync(this HttpClient client, string timelineName)
+ => client.TestGetAsync<TimelineInfo>($"timelines/{timelineName}");
+
+ public static Task<TimelineInfo> PatchTimelineAsync(this HttpClient client, string timelineName, TimelinePatchRequest body)
+ => client.TestPatchAsync<TimelineInfo>($"timelines/{timelineName}", body);
+
+ public static Task PutTimelineMemberAsync(this HttpClient client, string timelineName, string memberUsername)
+ => client.TestPutAsync($"timelines/{timelineName}/members/{memberUsername}");
+
+ public static Task DeleteTimelineMemberAsync(this HttpClient client, string timelineName, string memberUsername, bool? delete)
+ => client.TestDeleteAsync($"timelines/{timelineName}/members/{memberUsername}", delete);
+ }
+}
|