< Summary

Information
Class: Elsa.Workflows.Runtime.DefaultActivityExecutionManager
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Services/DefaultActivityExecutionManager.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 14
Coverable lines: 14
Total lines: 43
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 4
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
DeleteManyAsync()0%2040%
SaveAsync()100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Services/DefaultActivityExecutionManager.cs

#LineLine coverage
 1using Elsa.Mediator.Contracts;
 2using Elsa.Workflows.Runtime.Entities;
 3using Elsa.Workflows.Runtime.Filters;
 4using Elsa.Workflows.Runtime.Notifications;
 5
 6namespace Elsa.Workflows.Runtime;
 7
 8/// <inheritdoc />
 9public class DefaultActivityExecutionManager : IActivityExecutionManager
 10{
 11    private readonly IActivityExecutionStore _store;
 12    private readonly INotificationSender _notificationSender;
 13
 14    /// <summary>
 15    /// Initializes a new instance of the <see cref="DefaultActivityExecutionManager"/> class.
 16    /// </summary>
 017    public DefaultActivityExecutionManager(IActivityExecutionStore store, INotificationSender notificationSender)
 18    {
 019        _store = store;
 020        _notificationSender = notificationSender;
 021    }
 22
 23    /// <inheritdoc />
 24    public async Task<long> DeleteManyAsync(ActivityExecutionRecordFilter filter, CancellationToken cancellationToken = 
 25    {
 026        var records = (await _store.FindManyAsync(filter, cancellationToken)).ToList();
 27
 028        foreach (var record in records)
 29        {
 030            await _store.DeleteManyAsync(filter, cancellationToken);
 031            await _notificationSender.SendAsync(new ActivityExecutionRecordDeleted(record), cancellationToken);
 032        }
 33
 034        return records.Count;
 035    }
 36
 37    /// <inheritdoc />
 38    public async Task SaveAsync(ActivityExecutionRecord record, CancellationToken cancellationToken = default)
 39    {
 040        await _store.SaveAsync(record, cancellationToken);
 041        await _notificationSender.SendAsync(new ActivityExecutionRecordUpdated(record), cancellationToken);
 042    }
 43}