From 65cd23ff3e1a89cf3e60ee4e70e4f711a1ba79da Mon Sep 17 00:00:00 2001 From: gewuyou <95328647+GeWuYou@users.noreply.github.com> Date: Sat, 25 Apr 2026 09:55:10 +0800 Subject: [PATCH] =?UTF-8?q?test(core-tests):=20=E7=AE=80=E5=8C=96=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E4=B8=8E=E5=8D=8F=E7=A8=8B=E5=BC=82=E6=AD=A5=E6=96=AD?= =?UTF-8?q?=E8=A8=80=E5=8C=85=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 简化 ResultExtensionsTests 中的异步异常断言包装 - 更新 AsyncOperationTests 的 Task 断言写法以消除低风险 analyzer 噪音 --- GFramework.Core.Tests/Coroutine/AsyncOperationTests.cs | 4 ++-- GFramework.Core.Tests/Extensions/ResultExtensionsTests.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/GFramework.Core.Tests/Coroutine/AsyncOperationTests.cs b/GFramework.Core.Tests/Coroutine/AsyncOperationTests.cs index d246c7cf..6f3b080b 100644 --- a/GFramework.Core.Tests/Coroutine/AsyncOperationTests.cs +++ b/GFramework.Core.Tests/Coroutine/AsyncOperationTests.cs @@ -104,7 +104,7 @@ public class AsyncOperationTests op.SetException(expectedException); - Assert.That(async () => await op.Task, Throws.InstanceOf()); + Assert.That(() => op.Task, Throws.InstanceOf()); } /// @@ -339,4 +339,4 @@ public class AsyncOperationTests Assert.DoesNotThrow(() => op.SetCompleted()); } -} \ No newline at end of file +} diff --git a/GFramework.Core.Tests/Extensions/ResultExtensionsTests.cs b/GFramework.Core.Tests/Extensions/ResultExtensionsTests.cs index 9d363da5..aaa78210 100644 --- a/GFramework.Core.Tests/Extensions/ResultExtensionsTests.cs +++ b/GFramework.Core.Tests/Extensions/ResultExtensionsTests.cs @@ -487,7 +487,7 @@ public class ResultExtensionsTests [Test] public void TryAsync_Should_Throw_ArgumentNullException_When_Function_Is_Null() { - Assert.ThrowsAsync(async () => await ResultExtensions.TryAsync(null!)); + Assert.ThrowsAsync(() => ResultExtensions.TryAsync(null!)); } ///