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

namespace StellaOps.Authority.Plugins.Abstractions.Tests;

public class AuthorityUserRegistrationTests
{
    [Fact]
    public void Constructor_Throws_WhenUsernameMissing()
    {
        Assert.Throws<ArgumentException>(() => new AuthorityUserRegistration(string.Empty, null, null, null, false));
    }

    [Fact]
    public void WithPassword_ReturnsCopyWithPassword()
    {
        var registration = new AuthorityUserRegistration("alice", null, "Alice", null, true);

        var updated = registration.WithPassword("secret");

        Assert.Equal("alice", updated.Username);
        Assert.Equal("secret", updated.Password);
        Assert.True(updated.RequirePasswordReset);
    }
}
