< Summary

Information
Class: Elsa.Workflows.PropertyDefaultValueResolver
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Services/PropertyDefaultValueResolver.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 26
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
GetDefaultValue(...)100%44100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Services/PropertyDefaultValueResolver.cs

#LineLine coverage
 1using System.Reflection;
 2using Elsa.Workflows.Attributes;
 3using Microsoft.Extensions.DependencyInjection;
 4
 5namespace Elsa.Workflows;
 6
 7/// <inheritdoc />
 5288public class PropertyDefaultValueResolver(IServiceScopeFactory scopeFactory) : IPropertyDefaultValueResolver
 9{
 10    /// <inheritdoc />
 11    public object? GetDefaultValue(PropertyInfo activityPropertyInfo)
 12    {
 1733713        var inputAttribute = activityPropertyInfo.GetCustomAttribute<InputAttribute>();
 14
 1733715        if (inputAttribute == null)
 83016            return null;
 17
 1650718        if (inputAttribute.DefaultValueProvider == null)
 1617519            return inputAttribute.DefaultValue;
 20
 33221        var providerType = inputAttribute.DefaultValueProvider;
 33222        using var scope = scopeFactory.CreateScope();
 33223        var provider = (IActivityPropertyDefaultValueProvider) ActivatorUtilities.GetServiceOrCreateInstance(scope.Servi
 33224        return provider.GetDefaultValue(activityPropertyInfo);
 33225    }
 26}