mirror of
https://github.com/xeghosted/OrbisForge.git
synced 2026-10-12 06:43:32 +02:00
43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
using OrbisForge.Core;
|
|
using Xunit;
|
|
|
|
namespace OrbisForge.Core.Tests;
|
|
|
|
public class ProjectOptionsTests
|
|
{
|
|
[Theory]
|
|
[InlineData("my_project", "my_project")]
|
|
[InlineData("my project", "my_project")]
|
|
[InlineData(" spaced ", "spaced")]
|
|
[InlineData("a/b\\c", "a_b_c")]
|
|
[InlineData("kebab-case_2", "kebab-case_2")]
|
|
[InlineData("", "orbis_project")]
|
|
[InlineData(" ", "orbis_project")]
|
|
[InlineData("!!!", "___")]
|
|
public void SanitizedName_ReplacesNonAlphanumericSeparators(string input, string expected)
|
|
{
|
|
var options = new ProjectOptions { Name = input };
|
|
Assert.Equal(expected, options.SanitizedName);
|
|
}
|
|
|
|
[Fact]
|
|
public void SanitizedName_PreservesUnicodeLetters()
|
|
{
|
|
// char.IsLetterOrDigit is Unicode-aware, so accented letters pass through as-is
|
|
// rather than getting collapsed to underscores -- documenting that, not just assuming it.
|
|
var options = new ProjectOptions { Name = "héllo" };
|
|
Assert.Equal("héllo", options.SanitizedName);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(null, false)]
|
|
[InlineData("", false)]
|
|
[InlineData(" ", false)]
|
|
[InlineData("192.168.1.50", true)]
|
|
public void IncludeDeploy_TracksWhetherHostIsSet(string? host, bool expected)
|
|
{
|
|
var options = new ProjectOptions { Name = "x", DeployHost = host };
|
|
Assert.Equal(expected, options.IncludeDeploy);
|
|
}
|
|
}
|