using System;
using StellaOps.Authority.Plugins.Abstractions;

namespace StellaOps.Authority.Plugins.Abstractions.Tests;

public class AuthorityUserDescriptorTests
{
    [Fact]
    public void Constructor_Throws_WhenSubjectMissing()
    {
        Assert.Throws<ArgumentException>(() => new AuthorityUserDescriptor(string.Empty, "user", null, false));
    }

    [Fact]
    public void Constructor_Throws_WhenUsernameMissing()
    {
        Assert.Throws<ArgumentException>(() => new AuthorityUserDescriptor("subject", " ", null, false));
    }

    [Fact]
    public void Constructor_MaterialisesCollections()
    {
        var descriptor = new AuthorityUserDescriptor("subject", "user", null, false);

        Assert.NotNull(descriptor.Roles);
        Assert.NotNull(descriptor.Attributes);
    }
}
