< Summary

Information
Class: Elsa.Workflows.Management.Models.WorkflowDefinitionUpdateResult
Assembly: Elsa.Workflows.Management
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Management/Models/WorkflowDefinitionUpdateResult.cs
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 38
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
get_Outcome()100%11100%
Updated(...)100%11100%
NotFound()100%11100%
Conflict()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Management/Models/WorkflowDefinitionUpdateResult.cs

#LineLine coverage
 1using Elsa.Workflows.Management.Entities;
 2
 3namespace Elsa.Workflows.Management.Models;
 4
 5/// <summary>
 6/// The outcome of <see cref="IWorkflowDefinitionStore.TryUpdateLatestAsync"/>.
 7/// </summary>
 8public enum WorkflowDefinitionUpdateOutcome
 9{
 10    /// <summary>The update ran and the definition was saved.</summary>
 11    Updated,
 12
 13    /// <summary>No definition matched the filter.</summary>
 14    NotFound,
 15
 16    /// <summary>
 17    /// The loaded definition no longer matched what the caller expected — another writer saved first.
 18    /// </summary>
 19    Conflict
 20}
 21
 22/// <summary>
 23/// The result of a compare-and-swap update of the latest workflow definition.
 24/// </summary>
 25/// <param name="Outcome">Whether the swap saved, found nothing, or lost the race.</param>
 26/// <param name="Definition">The saved definition when <see cref="Outcome"/> is <see cref="WorkflowDefinitionUpdateOutco
 1827public sealed record WorkflowDefinitionUpdateResult(WorkflowDefinitionUpdateOutcome Outcome, WorkflowDefinition? Definit
 28{
 29    /// <summary>The update ran and <paramref name="definition"/> is what was saved.</summary>
 30    public static WorkflowDefinitionUpdateResult Updated(WorkflowDefinition definition) =>
 331        new(WorkflowDefinitionUpdateOutcome.Updated, definition);
 32
 33    /// <summary>No definition matched the filter.</summary>
 134    public static WorkflowDefinitionUpdateResult NotFound() => new(WorkflowDefinitionUpdateOutcome.NotFound);
 35
 36    /// <summary>Another writer saved first; the caller's expected snapshot is no longer current.</summary>
 337    public static WorkflowDefinitionUpdateResult Conflict() => new(WorkflowDefinitionUpdateOutcome.Conflict);
 38}