Files
pos-system/services/ads-manager-service-net/tests/AdsManagerService.FunctionalTests/Controllers/CampaignsControllerTests.cs

44 lines
1.1 KiB
C#

using System.Net;
using FluentAssertions;
using Microsoft.AspNetCore.Mvc.Testing;
using Xunit;
namespace AdsManagerService.FunctionalTests.Controllers;
/// <summary>
/// EN: Functional tests for campaign listing and health endpoints.
/// VI: Functional tests cho endpoint danh sách campaign và health.
/// </summary>
public class CampaignsControllerTests : IClassFixture<CustomWebApplicationFactory>
{
private readonly HttpClient _client;
public CampaignsControllerTests(CustomWebApplicationFactory factory)
{
_client = factory.CreateClient(new WebApplicationFactoryClientOptions
{
AllowAutoRedirect = false,
});
}
[Fact]
public async Task ListCampaigns_ShouldReturnOk()
{
// Act
var response = await _client.GetAsync("/api/v1/ads-manager/campaigns");
// 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);
}
}