using FluentAssertions;
using MembershipService.Domain.AggregatesModel.MemberAggregate;
using Xunit;

namespace MembershipService.UnitTests.Domain;

/// <summary>
/// EN: Unit tests for MembershipLevel enumeration.
/// VI: Unit tests cho MembershipLevel enumeration.
/// </summary>
public class MembershipLevelTests
{
    [Fact]
    public void MembershipLevel_ShouldHaveThreeLevels()
    {
        // Arrange & Act
        var levels = MembershipLevel.List();

        // Assert
        levels.Should().HaveCount(3);
    }

    [Fact]
    public void FromValue_ShouldReturnCorrectLevel()
    {
        // Act
        var free = MembershipLevel.FromValue<MembershipLevel>(1);
        var basic = MembershipLevel.FromValue<MembershipLevel>(2);
        var premium = MembershipLevel.FromValue<MembershipLevel>(3);

        // Assert
        free.Should().Be(MembershipLevel.Free);
        basic.Should().Be(MembershipLevel.Basic);
        premium.Should().Be(MembershipLevel.Premium);
    }

    [Fact]
    public void FromDisplayName_ShouldReturnCorrectLevel()
    {
        // Act
        var free = MembershipLevel.FromDisplayName<MembershipLevel>("Free");
        var basic = MembershipLevel.FromDisplayName<MembershipLevel>("Basic");
        var premium = MembershipLevel.FromDisplayName<MembershipLevel>("Premium");

        // Assert
        free.Should().Be(MembershipLevel.Free);
        basic.Should().Be(MembershipLevel.Basic);
        premium.Should().Be(MembershipLevel.Premium);
    }
}
