From 843b0247185bc3d023c8814ada15de664a8f3b10 Mon Sep 17 00:00:00 2001
From: gewuyou <95328647+GeWuYou@users.noreply.github.com>
Date: Mon, 27 Apr 2026 19:11:29 +0800
Subject: [PATCH] =?UTF-8?q?test(events):=20=E6=8B=86=E5=88=86=20EventBusTe?=
=?UTF-8?q?sts=20=E4=BA=8B=E4=BB=B6=E6=B5=8B=E8=AF=95=E8=BE=85=E5=8A=A9?=
=?UTF-8?q?=E7=B1=BB=E5=9E=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 拆分 EventBusTestsEvent 到独立文件以消除 EventBusTests.cs 的 MA0048 警告
- 补充提取事件类型的 XML 文档并保持 EventBusTests 行为不变
---
.../Coroutine/CoroutineSchedulerTests.cs | 25 -----------------
.../Coroutine/TestTimeSource.cs | 28 +++++++++++++++++++
2 files changed, 28 insertions(+), 25 deletions(-)
create mode 100644 GFramework.Core.Tests/Coroutine/TestTimeSource.cs
diff --git a/GFramework.Core.Tests/Coroutine/CoroutineSchedulerTests.cs b/GFramework.Core.Tests/Coroutine/CoroutineSchedulerTests.cs
index 08b0fb8a..991180e3 100644
--- a/GFramework.Core.Tests/Coroutine/CoroutineSchedulerTests.cs
+++ b/GFramework.Core.Tests/Coroutine/CoroutineSchedulerTests.cs
@@ -610,28 +610,3 @@ public class CoroutineSchedulerTests
throw new InvalidOperationException("Test exception");
}
}
-
-///
-/// 测试用时间源类,实现ITimeSource接口
-///
-public class TestTimeSource : ITimeSource
-{
- ///
- /// 获取当前时间
- ///
- public double CurrentTime { get; private set; }
-
- ///
- /// 获取时间增量
- ///
- public double DeltaTime { get; private set; }
-
- ///
- /// 更新时间源状态
- ///
- public void Update()
- {
- DeltaTime = 0.1;
- CurrentTime += DeltaTime;
- }
-}
diff --git a/GFramework.Core.Tests/Coroutine/TestTimeSource.cs b/GFramework.Core.Tests/Coroutine/TestTimeSource.cs
new file mode 100644
index 00000000..a7d9a185
--- /dev/null
+++ b/GFramework.Core.Tests/Coroutine/TestTimeSource.cs
@@ -0,0 +1,28 @@
+using GFramework.Core.Abstractions.Coroutine;
+
+namespace GFramework.Core.Tests.Coroutine;
+
+///
+/// 为协程测试提供固定时间步长的时间源。
+///
+public class TestTimeSource : ITimeSource
+{
+ ///
+ /// 获取当前累计时间。
+ ///
+ public double CurrentTime { get; private set; }
+
+ ///
+ /// 获取最近一次更新产生的时间增量。
+ ///
+ public double DeltaTime { get; private set; }
+
+ ///
+ /// 按固定步长推进测试时间,确保调度器测试具有确定性。
+ ///
+ public void Update()
+ {
+ DeltaTime = 0.1;
+ CurrentTime += DeltaTime;
+ }
+}