"Royal-Mail-shipping-integration-and-test-improvements"
This commit is contained in:
@@ -114,12 +114,13 @@ public class CatalogControllerTests : IClassFixture<TestWebApplicationFactory>
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
var products = JsonSerializer.Deserialize<List<ProductDto>>(content, _jsonOptions);
|
||||
var pagedResult = JsonSerializer.Deserialize<PagedResult<ProductDto>>(content, _jsonOptions);
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
||||
products.Should().NotBeNull();
|
||||
products.Should().HaveCountGreaterThan(0);
|
||||
pagedResult.Should().NotBeNull();
|
||||
pagedResult!.Items.Should().HaveCountGreaterThan(0);
|
||||
pagedResult.TotalCount.Should().BeGreaterThan(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -133,13 +134,13 @@ public class CatalogControllerTests : IClassFixture<TestWebApplicationFactory>
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
var products = JsonSerializer.Deserialize<List<ProductDto>>(content, _jsonOptions);
|
||||
var pagedResult = JsonSerializer.Deserialize<PagedResult<ProductDto>>(content, _jsonOptions);
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
||||
products.Should().NotBeNull();
|
||||
products.Should().HaveCountGreaterThan(0);
|
||||
products.Should().OnlyContain(p => p.CategoryId == categoryId);
|
||||
pagedResult.Should().NotBeNull();
|
||||
pagedResult!.Items.Should().HaveCountGreaterThan(0);
|
||||
pagedResult.Items.Should().OnlyContain(p => p.CategoryId == categoryId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user