< Summary

Information
Class: Elsa.Extensions.ActivityRegistryExtensions
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Extensions/ActivityRegistryExtensions.cs
Line coverage
66%
Covered lines: 2
Uncovered lines: 1
Coverable lines: 3
Total lines: 34
Line coverage: 66.6%
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
FindAsync(...)100%11100%
Find(...)100%11100%
RegisterAsync()100%210%

File(s)

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

#LineLine coverage
 1using Elsa.Workflows;
 2using Elsa.Workflows.Helpers;
 3using Elsa.Workflows.Models;
 4
 5// ReSharper disable once CheckNamespace
 6namespace Elsa.Extensions;
 7
 8/// <summary>
 9/// Adds extension methods to <see cref="IActivityRegistry"/>.
 10/// </summary>
 11public static class ActivityRegistryExtensions
 12{
 13    /// <summary>
 14    /// Finds the activity descriptor for the specified activity.
 15    /// </summary>
 354416    public static Task<ActivityDescriptor?> FindAsync(this IActivityRegistryLookupService activityRegistry, IActivity ac
 17
 18    /// <param name="activityRegistry">The activity registry.</param>
 19    extension(IActivityRegistry activityRegistry)
 20    {
 21        /// <summary>
 22        /// Finds the activity descriptor for the specified activity type.
 23        /// </summary>
 724        public ActivityDescriptor? Find<T>() where T:IActivity => activityRegistry.Find(ActivityTypeNameHelper.GenerateT
 25
 26        /// <summary>
 27        /// Registers the specified activity type with the registry.
 28        /// </summary>
 29        /// <param name="cancellationToken">The cancellation token.</param>
 30        /// <typeparam name="T">The type of the activity to register.</typeparam>
 31        public async Task RegisterAsync<T>(CancellationToken cancellationToken = default) where T : IActivity =>
 032            await activityRegistry.RegisterAsync(typeof(T), cancellationToken);
 33    }
 34}