mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 19:03:29 +08:00
- 优化 CommandCoroutineExtensions 中的代码格式和异常处理逻辑 - 简化 WaitForEvent 和 WaitForEventWithTimeout 中的EventData属性实现 - 调整 EventListenerScope 中的EventData属性访问器 - 重构 ControlExtensions 中 TakeIf 和 TakeUnless 方法的实现 - 优化 FunctionExtensions 中 Repeat 和 Partial 方法的代码结构 - 调整 PipeExtensions 和其他扩展类的文档注释格式 - 修改测试代码中的协程迭代和事件注册相关实现 - 优化 DataRepository 中的异步操作实现方式 = [release ci]
30 lines
827 B
C#
30 lines
827 B
C#
using GFramework.Core.functional.pipe;
|
||
using NUnit.Framework;
|
||
|
||
namespace GFramework.Core.Tests.functional.pipe;
|
||
|
||
/// <summary>
|
||
/// PipeExtensions扩展方法测试类,用于验证管道和函数组合扩展方法的正确性
|
||
/// 包括管道操作、函数组合等核心功能的测试
|
||
/// </summary>
|
||
[TestFixture]
|
||
public class PipeExtensionsTests
|
||
{
|
||
/// <summary>
|
||
/// 测试Also方法 - 验证执行操作后返回原值功能
|
||
/// </summary>
|
||
[Test]
|
||
public void Also_Should_Execute_Action_And_Return_Original_Value()
|
||
{
|
||
// Arrange
|
||
var value = 42;
|
||
var capturedValue = 0;
|
||
|
||
// Act
|
||
var result = value.Also(x => capturedValue = x);
|
||
|
||
// Assert
|
||
Assert.That(result, Is.EqualTo(42));
|
||
Assert.That(capturedValue, Is.EqualTo(42));
|
||
}
|
||
} |