using UniVerse.Domain.Services;
using Xunit;

namespace UniVerse.Api.Tests.DomainServices;

public class EnrollmentSlotPolicyTests
{
    [Theory]
    [InlineData(-1, 3)]
    [InlineData(0, 3)]
    [InlineData(1, 3)]
    [InlineData(2, 3)]
    [InlineData(3, 5)]
    [InlineData(4, 7)]
    [InlineData(10, 7)]
    public void GetLimitForLevel_UsesHighestMatchingRuleOrDefault(int level, int expectedSlots)
    {
        var slots = EnrollmentSlotPolicy.GetLimitForLevel(level);

        Assert.Equal(expectedSlots, slots);
    }

    [Fact]
    public void Rules_ExposeConfiguredThresholdsInAscendingOrder()
    {
        Assert.Equal(new[] { 1, 3, 4 }, EnrollmentSlotPolicy.Rules.Select(rule => rule.Level));
        Assert.Equal(new[] { 3, 5, 7 }, EnrollmentSlotPolicy.Rules.Select(rule => rule.Slots));
    }
}
