30 lines
1.3 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 Workflow.Application.Notifications;
using Workflow.Domain.Entities;
namespace BuildFlow.Workflow.Tests.Scheduler;
internal sealed class NoopNotificationService : INotificationService
{
public int TimeoutCallCount { get; private set; }
public List<WorkflowTask> TimeoutTasks { get; } = [];
public List<bool> AutoApprovedFlags { get; } = [];
public Task NotifyTaskArrivedAsync(WorkflowTask task, CancellationToken ct = default) => Task.CompletedTask;
public Task NotifyTaskApprovedAsync(WorkflowTask task, CancellationToken ct = default) => Task.CompletedTask;
public Task NotifyTaskRejectedAsync(WorkflowTask task, CancellationToken ct = default) => Task.CompletedTask;
public Task NotifyTaskUrgedAsync(WorkflowTask task, CancellationToken ct = default) => Task.CompletedTask;
public Task NotifyTaskTimeoutAsync(WorkflowTask task, bool autoApproved, CancellationToken ct = default)
{
TimeoutCallCount++;
TimeoutTasks.Add(task);
AutoApprovedFlags.Add(autoApproved);
return Task.CompletedTask;
}
}
/// <summary>
/// OverdueTaskProcessor 核心逻辑测试:逾期任务自动处理、Suspended 守卫、autoApproveOnTimeout 解析、
/// DueAt=null 跳过、空转。直接构造处理器实例,不依赖 HostedService/DI scope。
/// </summary>