mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-13 22:25:37 +08:00
test(events): 拆分 EventBusTests 事件测试辅助类型
- 拆分 EventBusTestsEvent 到独立文件以消除 EventBusTests.cs 的 MA0048 警告 - 补充提取事件类型的 XML 文档并保持 EventBusTests 行为不变
This commit is contained in:
parent
88c439c2ef
commit
843b024718
@ -610,28 +610,3 @@ public class CoroutineSchedulerTests
|
|||||||
throw new InvalidOperationException("Test exception");
|
throw new InvalidOperationException("Test exception");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 测试用时间源类,实现ITimeSource接口
|
|
||||||
/// </summary>
|
|
||||||
public class TestTimeSource : ITimeSource
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 获取当前时间
|
|
||||||
/// </summary>
|
|
||||||
public double CurrentTime { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取时间增量
|
|
||||||
/// </summary>
|
|
||||||
public double DeltaTime { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新时间源状态
|
|
||||||
/// </summary>
|
|
||||||
public void Update()
|
|
||||||
{
|
|
||||||
DeltaTime = 0.1;
|
|
||||||
CurrentTime += DeltaTime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
28
GFramework.Core.Tests/Coroutine/TestTimeSource.cs
Normal file
28
GFramework.Core.Tests/Coroutine/TestTimeSource.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using GFramework.Core.Abstractions.Coroutine;
|
||||||
|
|
||||||
|
namespace GFramework.Core.Tests.Coroutine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 为协程测试提供固定时间步长的时间源。
|
||||||
|
/// </summary>
|
||||||
|
public class TestTimeSource : ITimeSource
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前累计时间。
|
||||||
|
/// </summary>
|
||||||
|
public double CurrentTime { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取最近一次更新产生的时间增量。
|
||||||
|
/// </summary>
|
||||||
|
public double DeltaTime { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 按固定步长推进测试时间,确保调度器测试具有确定性。
|
||||||
|
/// </summary>
|
||||||
|
public void Update()
|
||||||
|
{
|
||||||
|
DeltaTime = 0.1;
|
||||||
|
CurrentTime += DeltaTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user