< Summary

Information
Class: Elsa.Workflows.Models.ActivityPort
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Models/ActivityPort.cs
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 25
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Activity()100%11100%
FromActivity(...)100%11100%
FromActivities(...)100%11100%
GetActivities()100%22100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Models/ActivityPort.cs

#LineLine coverage
 1namespace Elsa.Workflows.Models;
 2
 3/// <summary>
 4/// Represents a binding between an owner activity's port and a child activity.
 5/// </summary>
 433186public record ActivityPort(IActivity? Activity, ICollection<IActivity>? Activities, string PortName)
 7{
 8    /// <summary>
 9    /// Creates a new ActivityPort from the specified activity and port name.
 10    /// </summary>
 586411    public static ActivityPort FromActivity(IActivity activity, string portName) => new(activity, null, portName);
 12
 13    /// <summary>
 14    /// Creates a new ActivityPort from the specified activities and port name.
 15    /// </summary>
 415616    public static ActivityPort FromActivities(IEnumerable<IActivity> activities, string portName) => new(null, activitie
 17
 18    /// <summary>
 19    /// Returns the activities bound to the port. Returns a list even if the Activity is set and not Activities.
 20    /// </summary>
 21    public IEnumerable<IActivity> GetActivities()
 22    {
 1002023        return Activity != null ? [Activity] : Activities!.ToList();
 24    }
 25}