- Inbound.CountryCode (ISO alpha-2), set on publish; flag shown before the location name (SVG via country-flag-icons on the site, emoji in bot) - Node.Capacity (optional, not a limit); available inbounds report load percent of capacity or active config count, sorted least loaded first Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
950 B
C#
36 lines
950 B
C#
using PnvPanel.Application.Admin.Inbounds;
|
|
using Xunit;
|
|
|
|
namespace PnvPanel.Application.Tests.Admin.Inbounds;
|
|
|
|
public class PublishInboundCommandValidatorTests
|
|
{
|
|
private readonly PublishInboundCommandValidator _validator = new();
|
|
|
|
private static PublishInboundCommand Command(string? countryCode) =>
|
|
new(Guid.NewGuid(), true, "EU Fast", countryCode, []);
|
|
|
|
[Theory]
|
|
[InlineData(null)]
|
|
[InlineData("")]
|
|
[InlineData("DE")]
|
|
[InlineData("nl")]
|
|
public void Validate_WithEmptyOrAlpha2CountryCode_IsValid(string? countryCode)
|
|
{
|
|
var result = _validator.Validate(Command(countryCode));
|
|
|
|
Assert.True(result.IsValid);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("DEU")]
|
|
[InlineData("D")]
|
|
[InlineData("1E")]
|
|
public void Validate_WithInvalidCountryCode_IsInvalid(string countryCode)
|
|
{
|
|
var result = _validator.Validate(Command(countryCode));
|
|
|
|
Assert.False(result.IsValid);
|
|
}
|
|
}
|