From eb7a8c702cde461ca60790a0728137e042436e2b Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Thu, 9 Apr 2026 15:15:10 +0800 Subject: [PATCH] =?UTF-8?q?docs(tests):=20=E4=B8=BA=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=9B=86=E6=88=90=E6=B5=8B=E8=AF=95=E6=B7=BB=E5=8A=A0=E8=AF=A6?= =?UTF-8?q?=E7=BB=86=E7=9A=84XML=E6=96=87=E6=A1=A3=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 为ConsumerArchitecture构造函数添加参数验证和功能说明文档 - 为ConfigModule属性添加配置模块获取方法的详细说明 - 为Registry属性添加配置注册表访问的生命周期状态说明 - 为MonsterTable属性添加怪物配置表读取的异常处理和使用约束 - 为ProbeUtility属性添加配置可见性探针的功能说明 - 为ModuleOnlyArchitecture类添加模块共享测试的相关文档 - 为配置模块和注册表属性添加生命周期状态和使用时机说明 --- .../ArchitectureConfigIntegrationTests.cs | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/GFramework.Game.Tests/Config/ArchitectureConfigIntegrationTests.cs b/GFramework.Game.Tests/Config/ArchitectureConfigIntegrationTests.cs index 7e94d6a3..49e99af9 100644 --- a/GFramework.Game.Tests/Config/ArchitectureConfigIntegrationTests.cs +++ b/GFramework.Game.Tests/Config/ArchitectureConfigIntegrationTests.cs @@ -397,6 +397,11 @@ public class ArchitectureConfigIntegrationTests private readonly GameConfigModule _configModule; private readonly ConfigAwareProbeUtility _probeUtility = new(); + /// + /// 使用指定配置根目录创建一个消费者测试架构。 + /// + /// 测试配置根目录。 + /// 为空时抛出。 public ConsumerArchitecture(string configRoot) { if (configRoot == null) @@ -407,12 +412,43 @@ public class ArchitectureConfigIntegrationTests _configModule = CreateModule(configRoot); } + /// + /// 获取当前架构安装的配置模块。 + /// + /// + /// 该模块会在 中安装,并在架构进入 + /// 时完成首次加载。 + /// 调用方可通过该属性观察模块初始化状态,但不应在架构初始化完成前假定加载已经成功。 + /// public GameConfigModule ConfigModule => _configModule; + /// + /// 获取由配置模块暴露到架构上下文中的注册表。 + /// + /// + /// 该属性在模块安装后即可访问同一个注册表实例,但只有在模块首次加载完成后, + /// 其中的生成配置表读取才具备成功契约。 + /// public IConfigRegistry Registry => _configModule.Registry; + /// + /// 获取测试使用的怪物配置表。 + /// + /// 已经从 中解析出的怪物表包装。 + /// 当模块首次加载尚未完成时抛出。 + /// + /// 该属性用于断言生成访问器在架构初始化完成后可直接读取; + /// 它依赖模块在 utility 初始化阶段之前已经完成首次加载。 + /// public MonsterTable MonsterTable => Registry.GetMonsterTable(); + /// + /// 获取用于观测 utility 初始化阶段配置可见性的探针 utility。 + /// + /// + /// 该 utility 会在 中注册,并在 utility 初始化阶段读取配置表, + /// 用于验证配置模块是否按约定在更早的生命周期阶段完成首载。 + /// public ConfigAwareProbeUtility ProbeUtility => _probeUtility; /// @@ -431,8 +467,21 @@ public class ArchitectureConfigIntegrationTests /// private sealed class ModuleOnlyArchitecture(GameConfigModule configModule) : Architecture { + /// + /// 获取安装到当前测试架构中的配置模块。 + /// + /// + /// 该属性直接暴露传入的模块实例,便于测试验证同一模块实例跨架构复用时的生命周期约束。 + /// public GameConfigModule ConfigModule => configModule; + /// + /// 获取当前模块共享的配置注册表。 + /// + /// + /// 该注册表实例在模块安装后即与架构绑定,但只有在架构完成配置首载后, + /// 其中的强类型配置表访问才应被视为可用。 + /// public IConfigRegistry Registry => configModule.Registry; ///