Skip to content

Commit c059301

Browse files
committed
test(AttributeOptionsTests): 移除过时的短参数测试并更新连接字符串参数
更新测试用例以使用长参数格式(--connection-string)代替短参数(-c),同时移除不再相关的短参数测试用例
1 parent 35ddbc4 commit c059301

1 file changed

Lines changed: 3 additions & 18 deletions

File tree

GameFrameX.Foundation.Tests/Options/AttributeOptionsTests.cs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,7 @@ public void Build_WithCommandLineArgs_ShouldOverrideDefaultValues()
7575
Assert.Equal("默认值", options.NoAttributeProperty);
7676
}
7777

78-
[Fact]
79-
public void Build_WithShortNameArgs_ShouldMapToProperties()
80-
{
81-
// 安排
82-
var args = new[] { "-p", "5000", "--api-key", "secret123" };
83-
var builder = new OptionsBuilder<TestOptions>(args);
84-
85-
// 执行
86-
var options = builder.Build();
87-
88-
// 断言
89-
Assert.Equal(5000, options.Port);
90-
Assert.Equal("localhost", options.Host); // 默认值
91-
Assert.False(options.Verbose); // 默认值
92-
Assert.Equal("secret123", options.ApiKey);
93-
}
78+
9479

9580
[Fact]
9681
public void Build_WithEnvironmentVariables_ShouldApplyValues()
@@ -184,7 +169,7 @@ public void Build_WithBooleanFlag_ShouldSetToTrue()
184169
public void Build_WithMultipleAttributes_ShouldRespectAllAttributes()
185170
{
186171
// 安排
187-
var args = new[] { "-c", "Server=localhost;Database=test" };
172+
var args = new[] { "--connection-string", "Server=localhost;Database=test" };
188173
var builder = new OptionsBuilder<TestOptionsWithMultipleAttributes>(args);
189174

190175
// 执行
@@ -203,7 +188,7 @@ public void Build_WithMissingRequiredOptionInMultipleAttributes_ShouldThrowExcep
203188

204189
// 执行 & 断言
205190
var exception = Assert.Throws<ArgumentException>(() => builder.Build());
206-
Assert.Contains("connectionstring", exception.Message);
191+
Assert.Contains("connection-string", exception.Message);
207192
}
208193

209194
[Fact]

0 commit comments

Comments
 (0)