-
-
Notifications
You must be signed in to change notification settings - Fork 96
/
CarsTests.cs
41 lines (35 loc) · 1.18 KB
/
CarsTests.cs
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
31
32
33
34
35
36
37
38
39
40
41
using System.Net;
using FluentAssertions;
using HappyCode.NetCoreBoilerplate.Api.IntegrationTests.Extensions;
using HappyCode.NetCoreBoilerplate.Api.IntegrationTests.Infrastructure;
using HappyCode.NetCoreBoilerplate.Core.Dtos;
namespace HappyCode.NetCoreBoilerplate.Api.IntegrationTests
{
[Collection(nameof(TestServerClientCollection))]
public class CarsTests
{
private readonly HttpClient _client;
public CarsTests(TestServerClientFixture fixture)
{
_client = fixture.Client;
}
[Fact]
public async Task Get_should_return_Ok_with_results()
{
//when
var result = await _client.GetAsync($"api/cars");
//then
result.StatusCode.Should().Be(HttpStatusCode.OK);
var cars = await result.Content.ReadAsJsonAsync<List<CarDto>>();
cars.Count.Should().BeGreaterThan(0);
}
[Fact]
public Task Get_should_return_expected_json()
{
//when
var result = _client.GetAsync($"api/cars");
//then
return Verifier.Verify(result);
}
}
}