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

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(ErrorCodes.Http.Common.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(ErrorCodes.Http.Common.InvalidModel);
        }
    }
}