mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-13 14:14:29 +08:00
test(game-tests): 清理配置测试中的机械型 MA0004 包装
- 修复三个配置测试文件中 Assert.ThrowsAsync 与 Assert.DoesNotThrowAsync 的冗余 async/await 包装 - 调整文本校验异步异常测试签名以匹配去包装后的同步断言写法
This commit is contained in:
parent
877d1f38a6
commit
1dae0b11a0
@ -163,11 +163,11 @@ public class GameConfigBootstrapTests
|
|||||||
Is.True,
|
Is.True,
|
||||||
"The first initialization attempt did not reach the guarded lifecycle section.");
|
"The first initialization attempt did not reach the guarded lifecycle section.");
|
||||||
|
|
||||||
var secondCallerException = Assert.ThrowsAsync<InvalidOperationException>(async () => await bootstrap.InitializeAsync().ConfigureAwait(false));
|
var secondCallerException = Assert.ThrowsAsync<InvalidOperationException>(() => bootstrap.InitializeAsync());
|
||||||
|
|
||||||
continueInitialization.Set();
|
continueInitialization.Set();
|
||||||
|
|
||||||
Assert.DoesNotThrowAsync(async () => await firstInitializeTask.ConfigureAwait(false));
|
Assert.DoesNotThrowAsync(() => firstInitializeTask);
|
||||||
|
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
@ -202,7 +202,7 @@ public class GameConfigBootstrapTests
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
var exception = Assert.ThrowsAsync<ArgumentOutOfRangeException>(async () => await bootstrap.InitializeAsync().ConfigureAwait(false));
|
var exception = Assert.ThrowsAsync<ArgumentOutOfRangeException>(() => bootstrap.InitializeAsync());
|
||||||
|
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -75,7 +75,7 @@ public sealed class YamlConfigLoaderDependentRequiredTests
|
|||||||
var loader = CreateMonsterRewardLoader();
|
var loader = CreateMonsterRewardLoader();
|
||||||
var registry = CreateRegistry();
|
var registry = CreateRegistry();
|
||||||
|
|
||||||
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry).ConfigureAwait(false));
|
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
|
||||||
|
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
@ -217,7 +217,7 @@ public sealed class YamlConfigLoaderDependentRequiredTests
|
|||||||
var loader = CreateMonsterRewardLoader();
|
var loader = CreateMonsterRewardLoader();
|
||||||
var registry = CreateRegistry();
|
var registry = CreateRegistry();
|
||||||
|
|
||||||
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry).ConfigureAwait(false));
|
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
|
||||||
|
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
@ -267,7 +267,7 @@ public sealed class YamlConfigLoaderDependentRequiredTests
|
|||||||
var loader = CreateCaseSensitiveRewardLoader();
|
var loader = CreateCaseSensitiveRewardLoader();
|
||||||
var registry = CreateRegistry();
|
var registry = CreateRegistry();
|
||||||
|
|
||||||
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry).ConfigureAwait(false));
|
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
|
||||||
|
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
@ -317,7 +317,7 @@ public sealed class YamlConfigLoaderDependentRequiredTests
|
|||||||
var loader = CreateMonsterRewardLoader();
|
var loader = CreateMonsterRewardLoader();
|
||||||
var registry = CreateRegistry();
|
var registry = CreateRegistry();
|
||||||
|
|
||||||
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry).ConfigureAwait(false));
|
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
|
||||||
|
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -110,7 +110,7 @@ public sealed class YamlConfigTextValidatorTests
|
|||||||
/// 验证异步入口与同步入口共享相同校验语义。
|
/// 验证异步入口与同步入口共享相同校验语义。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public async Task ValidateAsync_Should_Throw_ConfigLoadException_When_Required_Field_Is_Missing()
|
public void ValidateAsync_Should_Throw_ConfigLoadException_When_Required_Field_Is_Missing()
|
||||||
{
|
{
|
||||||
var schemaPath = CreateSchemaFile(
|
var schemaPath = CreateSchemaFile(
|
||||||
"schemas/monster.schema.json",
|
"schemas/monster.schema.json",
|
||||||
@ -125,14 +125,14 @@ public sealed class YamlConfigTextValidatorTests
|
|||||||
}
|
}
|
||||||
""");
|
""");
|
||||||
|
|
||||||
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () =>
|
var exception = Assert.ThrowsAsync<ConfigLoadException>(() =>
|
||||||
await YamlConfigTextValidator.ValidateAsync(
|
YamlConfigTextValidator.ValidateAsync(
|
||||||
"monster",
|
"monster",
|
||||||
schemaPath,
|
schemaPath,
|
||||||
"monster/generated.yaml",
|
"monster/generated.yaml",
|
||||||
"""
|
"""
|
||||||
id: 1
|
id: 1
|
||||||
""").ConfigureAwait(false));
|
"""));
|
||||||
|
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user