< Summary

Information
Class: Elsa.Workflows.Runtime.Entities.ActivityExecutionRecordSummary
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Entities/ActivityExecutionRecordSummary.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 44
Coverable lines: 44
Total lines: 116
Line coverage: 0%
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
get_WorkflowInstanceId()100%210%
get_ActivityId()100%210%
get_ActivityNodeId()100%210%
get_ActivityType()100%210%
get_ActivityTypeVersion()100%210%
get_ActivityName()100%210%
get_StartedAt()100%210%
get_HasBookmarks()100%210%
get_Status()100%210%
get_Metadata()100%210%
get_AggregateFaultCount()100%210%
get_CompletedAt()100%210%
FromRecord(...)0%2040%
FromRecordExpression()100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Entities/ActivityExecutionRecordSummary.cs

#LineLine coverage
 1using System.Linq.Expressions;
 2using Elsa.Common.Entities;
 3
 4namespace Elsa.Workflows.Runtime.Entities;
 5
 6/// <summary>
 7/// Represents a summarized view of a single activity execution of an activity instance.
 8/// </summary>
 9public class ActivityExecutionRecordSummary : Entity
 10{
 11    /// <summary>
 12    /// Gets or sets the workflow instance ID.
 13    /// </summary>
 014    public string WorkflowInstanceId { get; set; } = null!;
 15
 16    /// <summary>
 17    /// Gets or sets the activity ID.
 18    /// </summary>
 019    public string ActivityId { get; set; } = null!;
 20
 21    /// <summary>
 22    /// Gets or sets the activity node ID.
 23    /// </summary>
 024    public string ActivityNodeId { get; set; } = null!;
 25
 26    /// <summary>
 27    /// The type of the activity.
 28    /// </summary>
 029    public string ActivityType { get; set; } = null!;
 30
 31    /// <summary>
 32    /// The version of the activity type.
 33    /// </summary>
 034    public int ActivityTypeVersion { get; set; }
 35
 36    /// <summary>
 37    /// The name of the activity.
 38    /// </summary>
 039    public string? ActivityName { get; set; }
 40
 41    /// <summary>
 42    /// Gets or sets the time at which the activity execution began.
 43    /// </summary>
 044    public DateTimeOffset StartedAt { get; set; }
 45
 46    /// <summary>
 47    /// Gets or sets whether the activity has any bookmarks.
 48    /// </summary>
 049    public bool HasBookmarks { get; set; }
 50
 51    /// <summary>
 52    /// Gets or sets the status of the activity.
 53    /// </summary>
 054    public ActivityStatus Status { get; set; }
 55
 56    /// <summary>
 57    /// Gets or sets a dictionary of key-value pairs representing additional metadata for the activity execution record 
 58    /// </summary>
 059    public IDictionary<string, object>? Metadata { get; set; }
 60
 61    /// <summary>
 62    /// Gets or sets the aggregated count of faults encountered during the execution of the activity instance and its de
 63    /// </summary>
 064    public int AggregateFaultCount { get; set; }
 65
 66    /// <summary>
 67    /// Gets or sets the time at which the activity execution completed.
 68    /// </summary>
 069    public DateTimeOffset? CompletedAt { get; set; }
 70
 71    /// <summary>
 72    /// Returns a summary view of the specified <see cref="ActivityExecutionRecord"/>.
 73    /// </summary>
 74    public static ActivityExecutionRecordSummary FromRecord(ActivityExecutionRecord record)
 75    {
 076        return new()
 077        {
 078            Id = record.Id,
 079            WorkflowInstanceId = record.WorkflowInstanceId,
 080            ActivityId = record.ActivityId,
 081            ActivityNodeId = record.ActivityNodeId,
 082            ActivityType = record.ActivityType,
 083            ActivityTypeVersion = record.ActivityTypeVersion,
 084            ActivityName = record.ActivityName,
 085            StartedAt = record.StartedAt,
 086            HasBookmarks = record.HasBookmarks,
 087            Status = record.Status,
 088            AggregateFaultCount = record.AggregateFaultCount,
 089            Metadata = record.Metadata?.Count > 0 ? record.Metadata : null,
 090            CompletedAt = record.CompletedAt,
 091        };
 92    }
 93
 94    /// <summary>
 95    /// Returns a summary view of the specified <see cref="ActivityExecutionRecord"/>.
 96    /// </summary>
 97    public static Expression<Func<ActivityExecutionRecord, ActivityExecutionRecordSummary>> FromRecordExpression()
 98    {
 099        return record => new()
 0100        {
 0101            Id = record.Id,
 0102            WorkflowInstanceId = record.WorkflowInstanceId,
 0103            ActivityId = record.ActivityId,
 0104            ActivityNodeId = record.ActivityNodeId,
 0105            ActivityType = record.ActivityType,
 0106            ActivityTypeVersion = record.ActivityTypeVersion,
 0107            ActivityName = record.ActivityName,
 0108            StartedAt = record.StartedAt,
 0109            HasBookmarks = record.HasBookmarks,
 0110            Status = record.Status,
 0111            AggregateFaultCount = record.AggregateFaultCount,
 0112            Metadata = record.Metadata,
 0113            CompletedAt = record.CompletedAt
 0114        };
 115    }
 116}