mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-07 08:44:29 +08:00
- 拆分 GFramework.Core.Tests 中多组测试辅助类型到独立文件以消减 MA0048 warning - 更新 analyzer-warning-reduction 的 tracking 与 trace 以记录批处理基线和下一恢复点 - 验证 GFramework.Core.Tests Release 构建清零并将仓库根权威 warning 基线压降到 288
45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using GFramework.Core.Abstractions.Architectures;
|
|
using GFramework.Core.Abstractions.Command;
|
|
|
|
namespace GFramework.Core.Tests.Architectures;
|
|
|
|
/// <summary>
|
|
/// 为 <see cref="ArchitectureContextTests" /> 提供的带返回值测试命令桩。
|
|
/// </summary>
|
|
public sealed class TestCommandWithResultV2 : ICommand<int>
|
|
{
|
|
private IArchitectureContext _context = null!;
|
|
|
|
/// <summary>
|
|
/// 获取或设置命令执行结果。
|
|
/// </summary>
|
|
public int Result { get; init; }
|
|
|
|
/// <summary>
|
|
/// 执行测试命令并返回预设结果。
|
|
/// </summary>
|
|
/// <returns>测试预设的命令结果。</returns>
|
|
public int Execute()
|
|
{
|
|
return Result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 关联当前命令所属的架构上下文。
|
|
/// </summary>
|
|
/// <param name="context">要保存的架构上下文。</param>
|
|
public void SetContext(IArchitectureContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取当前命令已绑定的架构上下文。
|
|
/// </summary>
|
|
/// <returns>测试期间保存的架构上下文。</returns>
|
|
public IArchitectureContext GetContext()
|
|
{
|
|
return _context;
|
|
}
|
|
}
|