aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline.Tests/IntegratedTests/HttpClientUserExtensions.cs
blob: 0ce2325f7b845b9e5511909dc9e9914418ea7ce5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Timeline.Models.Http;

namespace Timeline.Tests.IntegratedTests
{
    public static class HttpClientUserExtensions
    {
        public static async Task<UserInfo> GetUserAsync(this HttpClient client, string username)
        {
            var res = await client.GetAsync($"users/{username}");
            res.Should().HaveStatusCode(HttpStatusCode.OK);
            return await res.Should().HaveAndGetJsonBodyAsync<UserInfo>();
        }
    }
}