< Summary

Information
Class: Elsa.Workflows.ActivityCompletedContext
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Contexts/ActivityCompletedContext.cs
Line coverage
28%
Covered lines: 2
Uncovered lines: 5
Coverable lines: 7
Total lines: 42
Line coverage: 28.5%
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_TargetContext()100%11100%
get_WorkflowExecutionContext()100%11100%
GetRequiredService()100%210%
get_CancellationToken()100%210%
CompleteActivityAsync()100%210%
CompleteActivityWithOutcomesAsync(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Contexts/ActivityCompletedContext.cs

#LineLine coverage
 1using System.Diagnostics.CodeAnalysis;
 2using Elsa.Workflows.Activities.Flowchart.Models;
 3
 4namespace Elsa.Workflows;
 5
 6/// <summary>
 7/// Provides context information when an activity has completed.
 8/// </summary>
 107719public record ActivityCompletedContext(ActivityExecutionContext TargetContext, ActivityExecutionContext ChildContext, ob
 10{
 11    /// <summary>
 12    /// Gets the workflow execution context.
 13    /// </summary>
 40314    public WorkflowExecutionContext WorkflowExecutionContext => TargetContext.WorkflowExecutionContext;
 15
 16    /// <summary>
 17    /// Resolves a required service using the service provider.
 18    /// </summary>
 19    /// <typeparam name="T">The service type.</typeparam>
 20    /// <returns>The resolved service.</returns>
 021    public T GetRequiredService<T>() where T : notnull => WorkflowExecutionContext.GetRequiredService<T>();
 22
 23    /// <summary>
 24    /// A cancellation token to use when invoking asynchronous operations.
 25    /// </summary>
 026    public CancellationToken CancellationToken => WorkflowExecutionContext.CancellationToken;
 27
 28    /// <summary>
 29    /// Complete the current activity. This should only be called by activities that explicitly suppress automatic-compl
 30    /// </summary>
 31    [RequiresUnreferencedCode("The activity may be serialized and executed in a different context.")]
 32    public async ValueTask CompleteActivityAsync(object? result = default)
 33    {
 034        await TargetContext.CompleteActivityAsync(result);
 035    }
 36
 37    /// <summary>
 38    /// Complete the current activity with the specified outcomes.
 39    /// </summary>
 40    [RequiresUnreferencedCode("The activity may be serialized and executed in a different context.")]
 041    public ValueTask CompleteActivityWithOutcomesAsync(params string[] outcomes) => CompleteActivityAsync(new Outcomes(o
 42}