mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-06 16:16:44 +08:00
- 拆分 RegistryInitializationHookBaseTests 末尾的测试辅助类型到同目录独立文件以消除 MA0048 - 更新 TestRegistry 的公开集合暴露方式为只读接口以规避 MA0016 - 补充新测试辅助类型的 XML 文档并保持原有测试行为不变
27 lines
839 B
C#
27 lines
839 B
C#
using System.Collections.Generic;
|
|
using GFramework.Core.Abstractions.Utility;
|
|
|
|
namespace GFramework.Core.Tests.Architectures;
|
|
|
|
/// <summary>
|
|
/// 为 <see cref="RegistryInitializationHookBaseTests" /> 记录注册结果的测试注册表。
|
|
/// </summary>
|
|
public class TestRegistry : IUtility
|
|
{
|
|
private readonly List<string> _registeredConfigs = [];
|
|
|
|
/// <summary>
|
|
/// 获取已注册配置值的只读视图,避免将测试内部使用的列表实现暴露给调用方。
|
|
/// </summary>
|
|
public IReadOnlyList<string> RegisteredConfigs => _registeredConfigs;
|
|
|
|
/// <summary>
|
|
/// 记录一次配置注册。
|
|
/// </summary>
|
|
/// <param name="config">要追加到测试结果中的配置值。</param>
|
|
public void Register(string config)
|
|
{
|
|
_registeredConfigs.Add(config);
|
|
}
|
|
}
|