< Summary

Information
Class: Elsa.Workflows.Runtime.DefaultWorkflowActivationStrategyEvaluator
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Services/DefaultWorkflowActivationStrategyEvaluator.cs
Line coverage
46%
Covered lines: 6
Uncovered lines: 7
Coverable lines: 13
Total lines: 23
Line coverage: 46.1%
Branch coverage
25%
Covered branches: 1
Total branches: 4
Branch coverage: 25%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
CanStartWorkflowAsync()25%7445.45%

File(s)

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

#LineLine coverage
 1namespace Elsa.Workflows.Runtime;
 2
 683public class DefaultWorkflowActivationStrategyEvaluator(IEnumerable<IWorkflowActivationStrategy> strategies) : IWorkflow
 4{
 5    public async Task<bool> CanStartWorkflowAsync(WorkflowActivationStrategyEvaluationContext context)
 6    {
 167        var workflow = context.Workflow;
 168        var strategyType = workflow.Options.ActivationStrategyType;
 9
 1610        if (strategyType == null)
 1611            return true;
 12
 013        var strategy = strategies.FirstOrDefault(x => x.GetType() == strategyType);
 14
 015        if (strategy == null)
 016            return true;
 17
 018        var correlationId = context.CorrelationId;
 019        var cancellationToken = context.CancellationToken;
 020        var strategyContext = new WorkflowInstantiationStrategyContext(workflow, correlationId, cancellationToken);
 021        return await strategy.GetAllowActivationAsync(strategyContext);
 1622    }
 23}