-
-
Notifications
You must be signed in to change notification settings - Fork 96
/
PingsTests.cs
41 lines (35 loc) · 1.29 KB
/
PingsTests.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 FluentAssertions;
using HappyCode.NetCoreBoilerplate.Api.IntegrationTests.Infrastructure;
using HappyCode.NetCoreBoilerplate.Api.IntegrationTests.Infrastructure.Fakes;
namespace HappyCode.NetCoreBoilerplate.Api.IntegrationTests
{
[Collection(nameof(TestServerClientCollection))]
public class PingsTests
{
private readonly HttpClient _client;
public PingsTests(TestServerClientFixture fixture)
{
_client = fixture.Client;
}
[Fact]
public async Task Get_website_should_return_Ok_with_result()
{
//when
var result = await _client.GetAsync("api/pings/website");
//then
result.EnsureSuccessStatusCode();
var status = await result.Content.ReadAsStringAsync();
status.Should().Contain(FakePingService.Result.ToString());
}
[Fact]
public async Task Get_random_should_return_Ok_with_not_empty_result()
{
//when
var result = await _client.GetAsync("api/pings/random");
//then
result.EnsureSuccessStatusCode();
var status = await result.Content.ReadAsStringAsync();
status.Should().NotBeNullOrEmpty();
}
}
}