diff --git a/GFramework.SourceGenerators.Tests/rule/ContextAwareGeneratorTests.cs b/GFramework.SourceGenerators.Tests/rule/ContextAwareGeneratorTests.cs
index bdd5418..bb5d942 100644
--- a/GFramework.SourceGenerators.Tests/rule/ContextAwareGeneratorTests.cs
+++ b/GFramework.SourceGenerators.Tests/rule/ContextAwareGeneratorTests.cs
@@ -16,7 +16,7 @@ public class ContextAwareGeneratorTests
///
/// 异步任务
[Test]
- public async Task Generates_ContextAware_Code()
+ public Task Generates_ContextAware_Code()
{
// 定义输入源代码,包含使用[ContextAware]特性的部分类
const string source = """
@@ -72,16 +72,19 @@ public class ContextAwareGeneratorTests
}
""";
-
- // 执行源代码生成器测试
- await GeneratorTest.RunAsync(
- source + "\n" + frameworkStub,
- ("MyRule.ContextAware.g.cs", expected)
- );
+ Assert.DoesNotThrowAsync(async () =>
+ {
+ // 执行源代码生成器测试
+ await GeneratorTest.RunAsync(
+ source + "\n" + frameworkStub,
+ ("MyRule.ContextAware.g.cs", expected)
+ );
+ });
+ return Task.CompletedTask;
}
[Test]
- public async Task Generates_ContextAware_Code_When_Interface_Inherits_IContextAware()
+ public Task Generates_ContextAware_Code_When_Interface_Inherits_IContextAware()
{
const string source = """
using System;
@@ -141,10 +144,13 @@ public class ContextAwareGeneratorTests
}
}
""";
-
- await GeneratorTest.RunAsync(
- source + "\n" + frameworkStub,
- ("MyRule.ContextAware.g.cs", expected)
- );
+ Assert.DoesNotThrowAsync(async () =>
+ {
+ await GeneratorTest.RunAsync(
+ source + "\n" + frameworkStub,
+ ("MyRule.ContextAware.g.cs", expected)
+ );
+ });
+ return Task.CompletedTask;
}
}
\ No newline at end of file