GFramework/GFramework.Core.Tests/Architectures/AdditionalAssemblyNotificationHandlerState.cs
gewuyou f0a36de07c test(core-tests): 批量拆分测试辅助类型以消减警告
- 拆分 GFramework.Core.Tests 中多组测试辅助类型到独立文件以消减 MA0048 warning

- 更新 analyzer-warning-reduction 的 tracking 与 trace 以记录批处理基线和下一恢复点

- 验证 GFramework.Core.Tests Release 构建清零并将仓库根权威 warning 基线压降到 288
2026-04-27 19:44:07 +08:00

34 lines
1.0 KiB
C#

namespace GFramework.Core.Tests.Architectures;
/// <summary>
/// 记录模拟扩展程序集通知处理器的执行次数。
/// </summary>
public static class AdditionalAssemblyNotificationHandlerState
{
private static int _invocationCount;
/// <summary>
/// 获取当前测试进程中该处理器的执行次数。
/// </summary>
/// <remarks>
/// 该计数器通过原子读写维护,以支持 NUnit 并行执行环境中的并发访问。
/// </remarks>
public static int InvocationCount => Volatile.Read(ref _invocationCount);
/// <summary>
/// 记录一次通知处理,供测试断言显式程序集接入后的运行时行为。
/// </summary>
public static void RecordInvocation()
{
Interlocked.Increment(ref _invocationCount);
}
/// <summary>
/// 清理共享计数器,避免测试间相互污染。
/// </summary>
public static void Reset()
{
Interlocked.Exchange(ref _invocationCount, 0);
}
}