using System.Net;
using FluentAssertions;
using SIGCM2.TestSupport;
using Xunit;

namespace SIGCM2.Api.Tests.Audit;

/// UDT-010 Batch 10 — /health/audit integration smoke.
[Collection("ApiIntegration")]
public sealed class AuditHealthCheckTests : IClassFixture<TestWebAppFactory>
{
    private readonly TestWebAppFactory _factory;

    public AuditHealthCheckTests(TestWebAppFactory factory)
    {
        _factory = factory;
    }

    [Fact]
    public async Task HealthAudit_WithInfraApplied_ReturnsHealthy()
    {
        var client = _factory.CreateClient();

        var response = await client.GetAsync("/health/audit");

        response.StatusCode.Should().Be(HttpStatusCode.OK);
        var body = await response.Content.ReadAsStringAsync();
        body.Should().Contain("Healthy");
    }
}
