aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/Helpers/InvalidModelTestHelpers.cs
blob: af432095b80d3da31e17869da8cd342b44796797 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using System.Net.Http;
using System.Threading.Tasks;
using Timeline.Models.Http;

namespace Timeline.Tests.Helpers
{
    public static class InvalidModelTestHelpers
    {
        public static async Task TestPostInvalidModel<T>(HttpClient client, string url, T body)
        {
            var response = await client.PostAsJsonAsync(url, body);
            response.Should().HaveStatusCodeBadRequest()
                .And.Should().HaveBodyAsCommonResponseWithCode(CommonResponse.ErrorCodes.InvalidModel);
        }

        public static async Task TestPutInvalidModel<T>(HttpClient client, string url, T body)
        {
            var response = await client.PutAsJsonAsync(url, body);
            response.Should().HaveStatusCodeBadRequest()
                .And.Should().HaveBodyAsCommonResponseWithCode(CommonResponse.ErrorCodes.InvalidModel);
        }
    }
}