using NexusShell.Services.Identity;
using Xunit;

namespace NexusShell.Tests;

public sealed class NexusOnboardingCatalogTests
{
    [Fact]
    public void OrganizationCatalog_IsNotEmpty()
    {
        Assert.NotEmpty(NexusOrganizationCatalog.All);
    }

    [Fact]
    public void OrganizationCatalog_EntriesHaveIdAndName()
    {
        foreach (var org in NexusOrganizationCatalog.All)
        {
            Assert.False(string.IsNullOrWhiteSpace(org.Id));
            Assert.False(string.IsNullOrWhiteSpace(org.Name));
        }
    }

    [Fact]
    public void OrganizationCatalog_IdsAreUnique()
    {
        var ids = NexusOrganizationCatalog.All.Select(o => o.Id).ToList();
        Assert.Equal(ids.Count, ids.Distinct(StringComparer.OrdinalIgnoreCase).Count());
    }

    [Theory]
    [InlineData("ORG-NINJA-PLATFORME", "Ninja Platforme ApS")]
    [InlineData("ORG-NINJAKERNEN", "Ninjakernen Holding ApS")]
    public void OrganizationCatalog_FindById_ReturnsMatch(string id, string expectedName)
    {
        var org = NexusOrganizationCatalog.FindById(id);
        Assert.NotNull(org);
        Assert.Equal(expectedName, org!.Name);
    }
}
