"Royal-Mail-shipping-integration-and-test-improvements"

This commit is contained in:
sysadmin
2025-09-08 03:53:28 +01:00
parent be4d797c6c
commit bcca00ab39
9 changed files with 1002 additions and 106 deletions

View File

@@ -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]