using GFramework.Game.Config;
namespace GFramework.Game.Tests.Config;
///
/// 验证 YAML 配置表注册选项会在构造阶段建立最小不变量,避免非法路径状态继续向后传播。
///
[TestFixture]
public class YamlConfigTableRegistrationOptionsTests
{
///
/// 验证构造函数会拒绝空的或仅空白字符的表名。
///
/// 待验证的表名。
[TestCase(null)]
[TestCase("")]
[TestCase(" ")]
public void Constructor_Should_Throw_When_Table_Name_Is_Null_Or_Whitespace(string? tableName)
{
var exception = Assert.Throws(() =>
_ = new YamlConfigTableRegistrationOptions(
tableName!,
"monster",
static config => config.Length));
Assert.That(exception!.ParamName, Is.EqualTo("tableName"));
}
///
/// 验证构造函数会拒绝空的或仅空白字符的相对目录路径。
///
/// 待验证的相对目录路径。
[TestCase(null)]
[TestCase("")]
[TestCase(" ")]
public void Constructor_Should_Throw_When_Relative_Path_Is_Null_Or_Whitespace(string? relativePath)
{
var exception = Assert.Throws(() =>
_ = new YamlConfigTableRegistrationOptions(
"monster",
relativePath!,
static config => config.Length));
Assert.That(exception!.ParamName, Is.EqualTo("relativePath"));
}
}