< Summary

Information
Class: Elsa.Workflows.Runtime.Responses.DispatchWorkflowResponse
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Responses/DispatchWorkflowDefinitionResponse.cs
Line coverage
57%
Covered lines: 4
Uncovered lines: 3
Coverable lines: 7
Total lines: 37
Line coverage: 57.1%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Fault()100%11100%
Success()100%11100%
UnknownChannel()100%210%
get_Succeeded()100%210%
ThrowIfFailed()50%2266.66%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Responses/DispatchWorkflowDefinitionResponse.cs

#LineLine coverage
 1using Elsa.Workflows.Exceptions;
 2
 3namespace Elsa.Workflows.Runtime.Responses;
 4
 5/// <summary>
 6/// Represents the response of a dispatch action for a workflow definition.
 7/// </summary>
 318public record DispatchWorkflowResponse(FaultException? Fault)
 9{
 10    /// <summary>
 11    /// Creates a response indicating that the dispatch action was successful.
 12    /// </summary>
 13    /// <returns></returns>
 2314    public static DispatchWorkflowResponse Success() => new(default(FaultException?));
 15
 16    /// <summary>
 17    /// Creates a response indicating that the specified channel does not exist.
 18    /// </summary>
 019    public static DispatchWorkflowResponse UnknownChannel() => new(new FaultException(RuntimeFaultCodes.UnknownChannel, 
 20
 21    /// <summary>
 22    /// Gets a value indicating whether the dispatch of a workflow definition succeeded.
 23    /// </summary>
 24    /// <value>
 25    /// <c>true</c> if the dispatch succeeded; otherwise, <c>false</c>.
 26    /// </value>
 027    public bool Succeeded => Fault == null;
 28
 29    /// <summary>
 30    /// Throws an exception if the dispatch failed.
 31    /// </summary>
 32    public void ThrowIfFailed()
 33    {
 834        if (Fault != null)
 035            throw Fault;
 836    }
 37}