| | | 1 | | using Elsa.Mediator.Contracts; |
| | | 2 | | using Elsa.Testing.Shared.Services; |
| | | 3 | | using Elsa.Workflows.Management.Notifications; |
| | | 4 | | using Elsa.Workflows.Notifications; |
| | | 5 | | using Elsa.Workflows.Runtime.Notifications; |
| | | 6 | | using JetBrains.Annotations; |
| | | 7 | | |
| | | 8 | | namespace Elsa.Testing.Shared.Handlers; |
| | | 9 | | |
| | | 10 | | [UsedImplicitly] |
| | 319 | 11 | | public class WorkflowEventHandlers(WorkflowEvents workflowEvents) : |
| | | 12 | | INotificationHandler<WorkflowFinished>, |
| | | 13 | | INotificationHandler<WorkflowInstanceSaved>, |
| | | 14 | | INotificationHandler<WorkflowStateCommitted>, |
| | | 15 | | INotificationHandler<ActivityExecuted>, |
| | | 16 | | INotificationHandler<ActivityExecutionLogUpdated> |
| | | 17 | | { |
| | | 18 | | public Task HandleAsync(WorkflowFinished notification, CancellationToken cancellationToken) |
| | | 19 | | { |
| | 279 | 20 | | workflowEvents.OnWorkflowFinished(new(notification.Workflow, notification.WorkflowState)); |
| | 279 | 21 | | return Task.CompletedTask; |
| | | 22 | | } |
| | | 23 | | |
| | | 24 | | public Task HandleAsync(WorkflowInstanceSaved notification, CancellationToken cancellationToken) |
| | | 25 | | { |
| | 349 | 26 | | workflowEvents.OnWorkflowInstanceSaved(new(notification.WorkflowInstance)); |
| | 349 | 27 | | return Task.CompletedTask; |
| | | 28 | | } |
| | | 29 | | |
| | | 30 | | public Task HandleAsync(WorkflowStateCommitted notification, CancellationToken cancellationToken) |
| | | 31 | | { |
| | 323 | 32 | | workflowEvents.OnWorkflowStateCommitted(new(notification.WorkflowExecutionContext, notification.WorkflowState, n |
| | 323 | 33 | | return Task.CompletedTask; |
| | | 34 | | } |
| | | 35 | | |
| | | 36 | | public Task HandleAsync(ActivityExecuted notification, CancellationToken cancellationToken) |
| | | 37 | | { |
| | 2392 | 38 | | workflowEvents.OnActivityExecuted(new(notification.ActivityExecutionContext)); |
| | 2392 | 39 | | return Task.CompletedTask; |
| | | 40 | | } |
| | | 41 | | |
| | | 42 | | public Task HandleAsync(ActivityExecutionLogUpdated notification, CancellationToken cancellationToken) |
| | | 43 | | { |
| | 323 | 44 | | workflowEvents.OnActivityExecutedLogUpdated(new(notification.WorkflowExecutionContext, notification.Records)); |
| | 323 | 45 | | return Task.CompletedTask; |
| | | 46 | | } |
| | | 47 | | } |