GFramework/GFramework.Core.Tests/Query/TestAsyncQueryWithException.cs
gewuyou ff553977e3 chore(license): 补齐 Apache-2.0 文件头治理
- 新增许可证文件头检查与修复脚本

- 补充维护者手动修复 PR 工作流和 CI 校验

- 更新贡献指南中的文件头说明

- 补齐仓库维护源码和配置文件的许可证声明
2026-05-03 19:39:49 +08:00

32 lines
1.1 KiB
C#

// Copyright (c) 2025-2026 GeWuYou
// SPDX-License-Identifier: Apache-2.0
using GFramework.Core.Query;
namespace GFramework.Core.Tests.Query;
/// <summary>
/// 为 <see cref="AsyncQueryExecutorTests" /> 提供固定抛出异常的测试异步查询。
/// </summary>
public sealed class TestAsyncQueryWithException : AbstractAsyncQuery<TestAsyncQueryInput, int>
{
/// <summary>
/// 初始化 <see cref="TestAsyncQueryWithException" /> 的新实例。
/// </summary>
/// <param name="input">查询输入参数。</param>
public TestAsyncQueryWithException(TestAsyncQueryInput input) : base(input)
{
}
/// <summary>
/// 执行异步查询并始终抛出测试异常。
/// </summary>
/// <param name="input">查询输入参数。</param>
/// <returns>此方法不会返回结果。</returns>
/// <exception cref="InvalidOperationException">始终抛出,模拟查询执行失败。</exception>
protected override Task<int> OnDoAsync(TestAsyncQueryInput input)
{
throw new InvalidOperationException("Test exception");
}
}