< Summary

Information
Class: Elsa.Extensions.WorkflowBuilderExtensions
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Extensions/WorkflowBuilderExtensions.cs
Line coverage
100%
Covered lines: 1
Uncovered lines: 0
Coverable lines: 1
Total lines: 25
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
BuildWorkflowAsync(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Extensions/WorkflowBuilderExtensions.cs

#LineLine coverage
 1using Elsa.Workflows;
 2using Elsa.Workflows.Activities;
 3
 4// ReSharper disable once CheckNamespace
 5namespace Elsa.Extensions;
 6
 7/// <summary>
 8/// Contains extensions for <see cref="IWorkflowBuilder"/>.
 9/// </summary>
 10public static class WorkflowBuilderExtensions
 11{
 12    /// <summary>
 13    /// Builds a workflow asynchronously.
 14    /// </summary>
 15    /// <typeparam name="T">The type of the workflow.</typeparam>
 16    /// <param name="builder">The <see cref="IWorkflowBuilder"/> instance to build the workflow.</param>
 17    /// <param name="cancellationToken">The cancellation token.</param>
 18    /// <returns>A task representing the asynchronous operation that returns the built <see cref="Workflow"/>.</returns>
 19    public static Task<Workflow> BuildWorkflowAsync<T>(
 20        this IWorkflowBuilder builder,
 21        CancellationToken cancellationToken = default) where T : IWorkflow, new()
 22    {
 223        return builder.BuildWorkflowAsync(Activator.CreateInstance<T>(), cancellationToken);
 24    }
 25}