From 1783245d22eb30be80a7edb753b950d2a43c1e80 Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Thu, 15 Jan 2026 22:00:05 +0800 Subject: [PATCH] =?UTF-8?q?test(rule):=20=E6=B7=BB=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E6=96=87=E6=84=9F=E7=9F=A5=E6=B5=8B=E8=AF=95=E7=9A=84?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E5=92=8C=E6=B8=85=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在测试设置中添加 GameContext 绑定 - 添加 TearDown 方法用于解绑上下文 - 确保测试后正确清理上下文状态 --- GFramework.Core.Tests/rule/ContextAwareTests.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/GFramework.Core.Tests/rule/ContextAwareTests.cs b/GFramework.Core.Tests/rule/ContextAwareTests.cs index d58e4b0..70cbf6b 100644 --- a/GFramework.Core.Tests/rule/ContextAwareTests.cs +++ b/GFramework.Core.Tests/rule/ContextAwareTests.cs @@ -1,5 +1,6 @@ using GFramework.Core.Abstractions.architecture; using GFramework.Core.Abstractions.rule; +using GFramework.Core.architecture; using GFramework.Core.rule; using GFramework.Core.Tests.architecture; using NUnit.Framework; @@ -14,6 +15,13 @@ public class ContextAwareTests { _contextAware = new TestContextAware(); _mockContext = new TestArchitectureContext(); + GameContext.Bind(typeof(TestArchitectureContext), _mockContext); + } + + [TearDown] + public void TearDown() + { + GameContext.Unbind(typeof(TestArchitectureContext)); } private TestContextAware _contextAware = null!;