GeWuYou fb14d7122c docs(style): 更新文档中的命名空间导入格式
- 将所有小写的命名空间导入更正为首字母大写格式
- 统一 GFramework 框架的命名空间引用规范
- 修复 core、ecs、godot 等模块的命名空间导入错误
- 标准化文档示例代码中的 using 语句格式
- 确保所有文档中的命名空间引用保持一致性
- 更新 global using 语句以匹配正确的命名空间格式
2026-03-10 07:18:49 +08:00

84 lines
2.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using GFramework.Core.Coroutine.Instructions;
using NUnit.Framework;
namespace GFramework.Core.Tests.Coroutine
{
/// <summary>
/// Delay类的单元测试用于验证延迟指令的功能
/// </summary>
[TestFixture]
public class DelayTests
{
/// <summary>
/// 测试构造函数设置初始剩余时间
/// </summary>
[Test]
public void Constructor_SetsInitialRemainingTime()
{
// Arrange & Act
var delay = new Delay(2.5);
// Assert
Assert.That(delay.IsDone, Is.False);
}
/// <summary>
/// 测试Update方法减少剩余时间
/// </summary>
[Test]
public void Update_ReducesRemainingTime()
{
// Arrange
var delay = new Delay(2.0);
// Act
delay.Update(0.5);
// Assert
Assert.That(delay.IsDone, Is.False);
}
/// <summary>
/// 测试多次Update后最终完成
/// </summary>
[Test]
public void Update_MultipleTimes_EventuallyCompletes()
{
// Arrange
var delay = new Delay(1.0);
// Act
delay.Update(0.5);
delay.Update(0.6); // Total: 1.1 > 1.0, so should be done
// Assert
Assert.That(delay.IsDone, Is.True);
}
/// <summary>
/// 测试负数时间被视为零
/// </summary>
[Test]
public void NegativeTime_TreatedAsZero()
{
// Arrange & Act
var delay = new Delay(-1.0);
// Assert
Assert.That(delay.IsDone, Is.True);
}
/// <summary>
/// 测试零时间立即完成
/// </summary>
[Test]
public void ZeroTime_CompletesImmediately()
{
// Arrange & Act
var delay = new Delay(0.0);
// Assert
Assert.That(delay.IsDone, Is.True);
}
}
}