using Jiaowu.Api.Domain.Academic;
using Jiaowu.Api.Infrastructure.Graduation;

namespace Jiaowu.Api.Tests;

public sealed class DegreeAwardRulesTests
{
    [Fact]
    public void Graduated_student_meeting_gpa_requirement_is_granted()
    {
        var conclusion = DegreeAwardRules.Evaluate(
            true, StudentStatus.Graduated, 3.12m, 2.0m);

        Assert.Equal(DegreeAwardConclusion.Granted, conclusion);
    }

    [Theory]
    [InlineData(false, StudentStatus.Graduated, 3.12, 2.0)]
    [InlineData(true, StudentStatus.Active, 3.12, 2.0)]
    [InlineData(true, StudentStatus.Graduated, 1.99, 2.0)]
    public void Missing_prerequisite_prevents_degree_award(
        bool graduationEligible,
        StudentStatus status,
        decimal averageGradePoint,
        decimal minimumGradePoint)
    {
        var conclusion = DegreeAwardRules.Evaluate(
            graduationEligible, status, averageGradePoint, minimumGradePoint);

        Assert.Equal(DegreeAwardConclusion.NotGranted, conclusion);
    }
}
