blob: 125435f98e9b2551a3b87a17451f0f39c6e931e2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Timeline.Models.Http;
namespace Timeline.Tests.IntegratedTests
{
public static class HttpClientTimelineExtensions
{
public static async Task<TimelineInfo> GetTimelineAsync(this HttpClient client, string timelineName)
{
var res = await client.GetAsync($"timelines/{timelineName}");
res.Should().HaveStatusCode(HttpStatusCode.OK);
return await res.Should().HaveAndGetJsonBodyAsync<TimelineInfo>();
}
public static async Task<TimelineInfo> PatchTimelineAsync(this HttpClient client, string timelineName, TimelinePatchRequest body)
{
var res = await client.PatchAsJsonAsync($"timelines/{timelineName}", body);
res.Should().HaveStatusCode(HttpStatusCode.OK);
return await res.Should().HaveAndGetJsonBodyAsync<TimelineInfo>();
}
public static async Task PutTimelineMemberAsync(this HttpClient client, string timelineName, string memberUsername)
{
var res = await client.PutAsync($"timelines/{timelineName}/members/{memberUsername}");
res.Should().HaveStatusCode(HttpStatusCode.OK);
}
}
}
|