using System.Net;
namespace ScadaLink.IntegrationTests;
///
/// WP-22: Readiness gating — /health/ready endpoint returns status code.
///
public class ReadinessTests : IClassFixture
{
private readonly ScadaLinkWebApplicationFactory _factory;
public ReadinessTests(ScadaLinkWebApplicationFactory factory)
{
_factory = factory;
}
[Fact]
public async Task HealthReady_ReturnsSuccessStatusCode()
{
using var client = _factory.CreateClient();
var response = await client.GetAsync("/health/ready");
// The endpoint should exist and return 200 OK (or 503 if not ready yet).
// For now, just verify the endpoint exists and returns a valid HTTP response.
Assert.True(
response.StatusCode == HttpStatusCode.OK || response.StatusCode == HttpStatusCode.ServiceUnavailable,
$"Expected 200 or 503 but got {response.StatusCode}");
}
}