Files
pos-system/services/order-service-net/tests/OrderService.FunctionalTests/Controllers/HealthChecksControllerTests.cs

34 lines
894 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>
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);
}
}