From 26ba3d62f6e470e7dd9155afa7df794596c4ea14 Mon Sep 17 00:00:00 2001 From: gewuyou <95328647+GeWuYou@users.noreply.github.com> Date: Mon, 27 Apr 2026 19:12:27 +0800 Subject: [PATCH] =?UTF-8?q?test(extensions):=20=E6=8B=86=E5=88=86=20UnRegi?= =?UTF-8?q?sterListExtensionTests=20=E6=B3=A8=E9=94=80=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E8=BE=85=E5=8A=A9=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 拆分 TestUnRegisterList 到独立文件以消除 MA0048 - 保留测试行为并补充测试替身的 XML 文档说明 --- .../Extensions/TestUnRegisterList.cs | 15 +++++++++++++++ .../Extensions/UnRegisterListExtensionTests.cs | 12 ------------ 2 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 GFramework.Core.Tests/Extensions/TestUnRegisterList.cs diff --git a/GFramework.Core.Tests/Extensions/TestUnRegisterList.cs b/GFramework.Core.Tests/Extensions/TestUnRegisterList.cs new file mode 100644 index 00000000..25ed33a6 --- /dev/null +++ b/GFramework.Core.Tests/Extensions/TestUnRegisterList.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using GFramework.Core.Abstractions.Events; + +namespace GFramework.Core.Tests.Extensions; + +/// +/// 为 提供可观察的 测试替身。 +/// +public class TestUnRegisterList : IUnRegisterList +{ + /// + /// 获取当前测试收集到的注销项列表,供断言扩展方法是否正确追加和清空元素。 + /// + public IList UnregisterList { get; } = new List(); +} diff --git a/GFramework.Core.Tests/Extensions/UnRegisterListExtensionTests.cs b/GFramework.Core.Tests/Extensions/UnRegisterListExtensionTests.cs index 8865fdc2..fb2d4864 100644 --- a/GFramework.Core.Tests/Extensions/UnRegisterListExtensionTests.cs +++ b/GFramework.Core.Tests/Extensions/UnRegisterListExtensionTests.cs @@ -1,4 +1,3 @@ -using GFramework.Core.Abstractions.Events; using GFramework.Core.Events; using GFramework.Core.Extensions; using NUnit.Framework; @@ -119,14 +118,3 @@ public class UnRegisterListExtensionTests Assert.That(callCount, Is.EqualTo(1)); } } - -/// -/// 测试用的UnRegisterList实现类,用于验证扩展方法功能 -/// -public class TestUnRegisterList : IUnRegisterList -{ - /// - /// 获取或设置注销列表 - /// - public IList UnregisterList { get; } = new List(); -} \ No newline at end of file