44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
using System.Net;
|
|
using FluentAssertions;
|
|
using Microsoft.AspNetCore.Mvc.Testing;
|
|
using Xunit;
|
|
|
|
namespace FnbEngine.FunctionalTests.Controllers;
|
|
|
|
/// <summary>
|
|
/// EN: Functional tests for table management endpoints.
|
|
/// VI: Functional tests cho endpoint quản lý bàn.
|
|
/// </summary>
|
|
public class TablesControllerTests : IClassFixture<CustomWebApplicationFactory>
|
|
{
|
|
private readonly HttpClient _client;
|
|
|
|
public TablesControllerTests(CustomWebApplicationFactory factory)
|
|
{
|
|
_client = factory.CreateClient(new WebApplicationFactoryClientOptions
|
|
{
|
|
AllowAutoRedirect = false,
|
|
});
|
|
}
|
|
|
|
[Fact]
|
|
public async Task GetTables_ShouldReturnOk()
|
|
{
|
|
// Act
|
|
var response = await _client.GetAsync($"/api/v1/tables?shopId={Guid.NewGuid()}");
|
|
|
|
// Assert
|
|
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task HealthCheck_ShouldReturnHealthy()
|
|
{
|
|
// Act
|
|
var response = await _client.GetAsync("/health/live");
|
|
|
|
// Assert
|
|
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
|
}
|
|
}
|