< Summary

Information
Class: Elsa.Workflows.Activities.Flowchart.Extensions.FlowchartExtensions
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Activities/Flowchart/Extensions/FlowchartExtensions.cs
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 17
Line coverage: 100%
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
GetRootActivity(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Activities/Flowchart/Extensions/FlowchartExtensions.cs

#LineLine coverage
 1namespace Elsa.Workflows.Activities.Flowchart.Extensions;
 2
 3public static class FlowchartExtensions
 4{
 5    public static IActivity? GetRootActivity(this Activities.Flowchart flowchart)
 6    {
 7        // Get the first activity that has no inbound connections.
 8458        var query =
 8459            from activity in flowchart.Activities
 89010            let inboundConnections = flowchart.Connections.Any(x => x.Target.Activity == activity)
 84211            where !inboundConnections
 168712            select activity;
 13
 84514        var rootActivity = query.FirstOrDefault();
 84515        return rootActivity;
 16    }
 17}