using FluentAssertions;
using WebClientTpos.Shared;
using Xunit;

namespace WebClientTpos.SmokeTests;

/// <summary>
/// EN: Smoke tests for TPOS shared API response helpers.
/// VI: Smoke tests cho helper API response dùng chung của TPOS.
/// </summary>
public class ApiResponseTests
{
    [Fact]
    public void Ok_ShouldReturnSuccessfulResponse()
    {
        // Act
        var response = ApiResponse<int>.Ok(200);

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

    [Fact]
    public void Fail_ShouldReturnFailedResponse()
    {
        // Act
        var response = ApiResponse.Fail("forbidden");

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