< Summary

Information
Class: Elsa.Workflows.CommitStates.DefaultCommitStrategyRegistry
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/CommitStates/Services/DefaultCommitStrategyRegistry.cs
Line coverage
60%
Covered lines: 6
Uncovered lines: 4
Coverable lines: 10
Total lines: 38
Line coverage: 60%
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%11100%
ListWorkflowStrategyRegistrations()100%210%
ListActivityStrategyRegistrations()100%210%
RegisterStrategy(...)100%11100%
RegisterStrategy(...)100%11100%
FindWorkflowStrategy(...)0%620%
FindActivityStrategy(...)0%620%

File(s)

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

#LineLine coverage
 1namespace Elsa.Workflows.CommitStates;
 2
 3public class DefaultCommitStrategyRegistry : ICommitStrategyRegistry
 4{
 1145    private readonly IDictionary<string, WorkflowCommitStrategyRegistration> _workflowStrategies = new Dictionary<string
 1146    private readonly IDictionary<string, ActivityCommitStrategyRegistration> _activityStrategies = new Dictionary<string
 7
 8
 9    public IEnumerable<WorkflowCommitStrategyRegistration> ListWorkflowStrategyRegistrations()
 10    {
 011        return _workflowStrategies.Values;
 12    }
 13
 14    public IEnumerable<ActivityCommitStrategyRegistration> ListActivityStrategyRegistrations()
 15    {
 016        return _activityStrategies.Values;
 17    }
 18
 19    public void RegisterStrategy(WorkflowCommitStrategyRegistration registration)
 20    {
 521        _workflowStrategies[registration.Metadata.Name] = registration;
 522    }
 23
 24    public void RegisterStrategy(ActivityCommitStrategyRegistration registration)
 25    {
 426        _activityStrategies[registration.Metadata.Name] = registration;
 427    }
 28
 29    public IWorkflowCommitStrategy? FindWorkflowStrategy(string name)
 30    {
 031        return _workflowStrategies.TryGetValue(name, out var registration) ? registration.Strategy : null;
 32    }
 33
 34    public IActivityCommitStrategy? FindActivityStrategy(string name)
 35    {
 036        return _activityStrategies.TryGetValue(name, out var registration) ? registration.Strategy : null;
 37    }
 38}