#region ========================================================================= USING ===================================================================================== using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; using Lumina.Presentation.Web.IntegrationTests.Common.Setup; using System.Diagnostics.CodeAnalysis; using System.Net; using System.Net.Http; using System.Threading.Tasks; #endregion namespace Lumina.Presentation.Web.IntegrationTests.Core.Health; /// /// Contains integration tests for the /health/live and /health/ready probe routes. /// [ExcludeFromCodeCoverage] public class HealthEndpointTests : IClassFixture { private readonly LuminaWebFactory _apiFactory; /// /// Initializes a new instance of the class. /// /// Injected Web application factory. public HealthEndpointTests(LuminaWebFactory apiFactory) { _apiFactory = apiFactory; } [Fact] public async Task HealthLive_WhenCalled_ShouldReturnOk() { // Arrange HttpClient client = WebTestHelpers.CreateAnonymousClient(_apiFactory); // Act HttpResponseMessage response = await client.GetAsync("/health/live"); // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); } [Fact] public async Task HealthReady_WhenApiIsReachable_ShouldReturnHealthy() { // Arrange HttpClient client = WebTestHelpers.CreateAnonymousClient(_apiFactory); // Act HttpResponseMessage response = await client.GetAsync("/health/ready"); string content = await response.Content.ReadAsStringAsync(); // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.Contains("Healthy", content, System.StringComparison.OrdinalIgnoreCase); } }