< Summary

Information
Class: Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions
Assembly: Elsa.Workflows.Management
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Management/Extensions/ServiceCollectionExtensions.cs
Line coverage
100%
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 23
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
AddActivityProvider(...)100%22100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Management/Extensions/ServiceCollectionExtensions.cs

#LineLine coverage
 1
 2
 3// ReSharper disable once CheckNamespace
 4
 5using Elsa.Workflows;
 6
 7namespace Microsoft.Extensions.DependencyInjection;
 8
 9/// <summary>
 10/// Provides extension methods to <see cref="IServiceCollection"/> for various kinds of services and providers.
 11/// </summary>
 12public static class ServiceCollectionExtensions
 13{
 14    /// <summary>
 15    /// Registers a <see cref="IActivityProvider"/>.
 16    /// </summary>
 17    public static IServiceCollection AddActivityProvider<T>(this IServiceCollection services) where T : class, IActivity
 18    {
 219        return services
 220            .AddScoped<T>()
 65021            .AddScoped<IActivityProvider, T>(sp => sp.GetRequiredService<T>());
 22    }
 23}