using System.Net; using FluentAssertions; using Microsoft.AspNetCore.Mvc.Testing; using Xunit; namespace ChatService.FunctionalTests.Controllers; /// /// EN: Functional tests for chat conversation endpoints. /// VI: Functional tests cho endpoint hội thoại chat. /// public class ConversationsControllerTests : IClassFixture { private readonly HttpClient _client; public ConversationsControllerTests(CustomWebApplicationFactory factory) { _client = factory.CreateClient(new WebApplicationFactoryClientOptions { AllowAutoRedirect = false, }); } [Fact] public async Task GetConversations_WithoutAuthentication_ShouldReturnUnauthorized() { // Act var response = await _client.GetAsync("/api/conversations?userId=" + Guid.NewGuid()); // Assert response.StatusCode.Should().Be(HttpStatusCode.Unauthorized); } [Fact] public async Task HealthCheck_ShouldReturnHealthy() { // Act var response = await _client.GetAsync("/health/live"); // Assert response.StatusCode.Should().Be(HttpStatusCode.OK); } }