using Shared.Contracts.Generated;
using Xunit;

namespace Shared.Contracts.Tests;

public sealed class KbxApiCatalogTests
{
    [Fact]
    public void Operation_ids_and_routes_are_unique()
    {
        Assert.NotEmpty(KbxApiCatalog.SourceSha256);
        Assert.Equal(KbxApiCatalog.All.Count, KbxApiCatalog.All.Select(x => x.Id).Distinct().Count());
        Assert.Equal(KbxApiCatalog.All.Count, KbxApiCatalog.All.Select(x => $"{x.Method} {x.Path}").Distinct().Count());
    }

    [Fact]
    public void Required_idempotency_is_not_used_by_get_queries()
    {
        Assert.DoesNotContain(KbxApiCatalog.All, x => x.Method == "GET" && x.Idempotency == "required");
    }
}
