using System.Net;
namespace ZB.MOM.WW.ScadaBridge.IntegrationTests;
///
/// Readiness gating — /health/ready endpoint returns status code.
///
public class ReadinessTests : IClassFixture
{
private readonly ScadaBridgeWebApplicationFactory _factory;
/// Initializes the test class with the web application factory.
/// The factory.
public ReadinessTests(ScadaBridgeWebApplicationFactory factory)
{
_factory = factory;
}
/// Verifies that the health ready endpoint returns a success status code.
/// A task that represents the asynchronous operation.
[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}");
}
}