using KArtSell.Modules.ModelOperations.Domain;

namespace KArtSell.ModelOperations.UnitTests;

public sealed class ModelOperationRegistryTests
{
    [Fact]
    public void Operation_codes_are_unique_and_no_auto_promotion_mode_exists()
    {
        var codes = ModelOperationRegistry.All.Select(x => x.OperationCode).ToArray();

        Assert.Equal(codes.Length, codes.Distinct(StringComparer.OrdinalIgnoreCase).Count());
        Assert.All(ModelOperationRegistry.All, operation =>
            Assert.Contains(operation.AutomationMode, new[]
            {
                AutomationMode.EvaluationOnly,
                AutomationMode.ProposalOnly,
                AutomationMode.DrillOnly
            }));
    }

    [Fact]
    public void Improvement_and_promotion_packet_jobs_are_proposal_only()
    {
        Assert.Equal(AutomationMode.ProposalOnly, ModelOperationRegistry.GetRequired("J21").AutomationMode);
        Assert.Equal(AutomationMode.ProposalOnly, ModelOperationRegistry.GetRequired("J22").AutomationMode);
    }
}
