Files
pos-system/microservices/services/order-service-net/tests/OrderService.FunctionalTests/Controllers/HealthChecksControllerTests.cs
Ho Ngoc Hai 76d75c753b Migrate
2026-05-23 18:37:02 +07:00

35 lines
923 B
C#

using System.Net;
using FluentAssertions;
using Microsoft.AspNetCore.Mvc.Testing;
using Xunit;
namespace OrderService.FunctionalTests.Controllers;
/// <summary>
/// EN: Functional tests for health check endpoints.
/// VI: Functional tests cho các endpoint kiểm tra sức khỏe.
/// </summary>
[Collection("OrderService")]
public class HealthChecksControllerTests : IClassFixture<CustomWebApplicationFactory>
{
private readonly HttpClient _client;
public HealthChecksControllerTests(CustomWebApplicationFactory factory)
{
_client = factory.CreateClient(new WebApplicationFactoryClientOptions
{
AllowAutoRedirect = false,
});
}
[Fact]
public async Task LiveHealthCheck_ShouldReturnOk()
{
// Act
var response = await _client.GetAsync("/health/live");
// Assert
response.StatusCode.Should().Be(HttpStatusCode.OK);
}
}