test(rule): 添加上下文感知测试的绑定和清理逻辑

- 在测试设置中添加 GameContext 绑定
- 添加 TearDown 方法用于解绑上下文
- 确保测试后正确清理上下文状态
This commit is contained in:
GeWuYou 2026-01-15 22:00:05 +08:00
parent ee3a087e35
commit 1783245d22

View File

@ -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!;