GeWuYou af583c101c refactor(core): 重构协程扩展和函数式编程相关代码
- 优化 CommandCoroutineExtensions 中的代码格式和异常处理逻辑
- 简化 WaitForEvent 和 WaitForEventWithTimeout 中的EventData属性实现
- 调整 EventListenerScope 中的EventData属性访问器
- 重构 ControlExtensions 中 TakeIf 和 TakeUnless 方法的实现
- 优化 FunctionExtensions 中 Repeat 和 Partial 方法的代码结构
- 调整 PipeExtensions 和其他扩展类的文档注释格式
- 修改测试代码中的协程迭代和事件注册相关实现
- 优化 DataRepository 中的异步操作实现方式
= [release ci]
2026-02-01 14:07:59 +08:00

30 lines
827 B
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.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));
}
}