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; + } +}