using KArtSell.Modules.ModelOperations.Domain;

namespace KArtSell.ModelOperations.UnitTests;

public sealed class ModelOperationExecutionBoundaryTests
{
    [Fact]
    public void Registry_definitions_are_unique_and_evidence_only()
    {
        Assert.Equal(ModelOperationRegistry.All.Count, ModelOperationRegistry.All.Select(x => x.OperationCode).Distinct().Count());
        Assert.All(ModelOperationRegistry.All, ModelOperationExecutionBoundary.EnsureAllowed);
    }

    [Fact]
    public void Registry_never_contains_order_or_auto_promotion_operations()
    {
        var forbidden = new[] { "ORDER", "BROKER", "AUTO_PROMOTE", "AUTO_ROLLBACK", "KIS_SUBMIT" };
        Assert.All(ModelOperationRegistry.All, operation =>
            Assert.DoesNotContain(forbidden, token => operation.Name.Contains(token, StringComparison.OrdinalIgnoreCase)));
    }
}
