From 7e2a1ff66d9f277561359308fd97bc0068842091 Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Sun, 15 Feb 2026 18:39:05 +0800 Subject: [PATCH] =?UTF-8?q?test(state):=20=E6=9B=B4=E6=96=B0=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=9C=BA=E4=B8=8A=E4=B8=8B=E6=96=87=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=AA=8C=E8=AF=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将断言修改为验证 GetContext 方法抛出 InvalidOperationException 异常 - 在状态机初始化前验证状态上下文为空的预期行为 - 保持初始化后状态上下文正确设置的验证逻辑 --- GFramework.Core.Tests/state/StateMachineSystemTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GFramework.Core.Tests/state/StateMachineSystemTests.cs b/GFramework.Core.Tests/state/StateMachineSystemTests.cs index b05ddc5..cb9facc 100644 --- a/GFramework.Core.Tests/state/StateMachineSystemTests.cs +++ b/GFramework.Core.Tests/state/StateMachineSystemTests.cs @@ -111,8 +111,8 @@ public class StateMachineSystemTests _stateMachine!.Register(state1); _stateMachine.Register(state2); - Assert.That(state1.GetContext(), Is.Null); - Assert.That(state2.GetContext(), Is.Null); + Assert.Throws(() => state1.GetContext()); + Assert.Throws(() => state2.GetContext()); _stateMachine.Init();