using FluentAssertions;
using WebClientBase.Shared;
using Xunit;

namespace WebClientBase.SmokeTests;

/// <summary>
/// EN: Smoke tests for shared API response contracts.
/// VI: Smoke tests cho contract API response dùng chung.
/// </summary>
public class ApiResponseTests
{
    [Fact]
    public void Ok_ShouldReturnSuccessWithPayload()
    {
        // Act
        var response = ApiResponse<string>.Ok("healthy");

        // Assert
        response.Success.Should().BeTrue();
        response.Data.Should().Be("healthy");
        response.Error.Should().BeNull();
    }

    [Fact]
    public void Fail_ShouldReturnErrorWithoutPayload()
    {
        // Act
        var response = ApiResponse<string>.Fail("bad-request");

        // Assert
        response.Success.Should().BeFalse();
        response.Data.Should().BeNull();
        response.Error.Should().Be("bad-request");
    }
}
