using Elsa.Workflows;
using Elsa.Workflows.Models;
using Elsa.Workflows.Options;
namespace Elsa.Testing.Shared;
///
/// Bypasses validation and schedules the activity immediately.
///
public class FakeWorkflowExecutionContextSchedulerStrategy : IWorkflowExecutionContextSchedulerStrategy
{
///
/// Schedules an activity within the workflow execution context.
///
/// The workflow execution context within which the activity will be scheduled.
/// The activity node representing the activity to be scheduled.
/// The execution context owning the activity execution.
/// Optional scheduling options for configuring the behavior of the scheduling process.
/// Returns an representing the scheduled activity work item.
public ActivityWorkItem Schedule(WorkflowExecutionContext context, ActivityNode activityNode, ActivityExecutionContext owner, ScheduleWorkOptions? options = null)
{
var workItem = new ActivityWorkItem(activityNode.Activity, owner);
context.Scheduler.Schedule(workItem);
return workItem;
}
}