#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Api.IntegrationTests.Common.Setup;
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Api.IntegrationTests.Core.Health;
///
/// Contains integration tests for the /health/ready probe route when the database is unreachable.
///
[ExcludeFromCodeCoverage]
public class HealthEndpointFailureTests : IClassFixture
{
private readonly HttpClient _client;
///
/// Initializes a new instance of the class.
///
/// Injected in-memory API factory with a failing database health check.
public HealthEndpointFailureTests(FailingDatabaseApiFactory apiFactory)
{
_client = apiFactory.CreateClient();
}
[Fact]
public async Task HealthReady_WhenDatabaseIsUnreachable_ShouldReturnServiceUnavailable()
{
// Act
HttpResponseMessage response = await _client.GetAsync("/health/ready");
// Assert
Assert.Equal(HttpStatusCode.ServiceUnavailable, response.StatusCode);
}
}