< Summary

Information
Class: Elsa.Workflows.StackBasedActivityScheduler
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Services/StackBasedActivityScheduler.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 8
Coverable lines: 8
Total lines: 34
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%210%
get_HasAny()100%210%
Schedule(...)100%210%
Take()100%210%
List()100%210%
Any(...)100%210%
Find(...)100%210%
Clear()100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Services/StackBasedActivityScheduler.cs

#LineLine coverage
 1using Elsa.Workflows.Models;
 2using JetBrains.Annotations;
 3
 4namespace Elsa.Workflows;
 5
 6/// <summary>
 7/// A LIFO stack based activity scheduler.
 8/// </summary>
 9[PublicAPI]
 10public class StackBasedActivityScheduler : IActivityScheduler
 11{
 012    private readonly Stack<ActivityWorkItem> _stack = new();
 13
 14    /// <inheritdoc />
 015    public bool HasAny => _stack.Any();
 16
 17    /// <inheritdoc />
 018    public void Schedule(ActivityWorkItem activity) => _stack.Push(activity);
 19
 20    /// <inheritdoc />
 021    public ActivityWorkItem Take() => _stack.Pop();
 22
 23    /// <inheritdoc />
 024    public IEnumerable<ActivityWorkItem> List() => _stack.ToList();
 25
 26    /// <inheritdoc />
 027    public bool Any(Func<ActivityWorkItem, bool> predicate) => _stack.Any(predicate);
 28
 29    /// <inheritdoc />
 030    public ActivityWorkItem? Find(Func<ActivityWorkItem, bool> predicate) => _stack.FirstOrDefault(predicate);
 31
 32    /// <inheritdoc />
 033    public void Clear() => _stack.Clear();
 34}