35 lines
923 B
C#
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);
|
|
}
|
|
}
|