< Summary

Information
Class: Elsa.Workflows.Management.Activities.WorkflowDefinitionActivity.PropertyNameHelper
Assembly: Elsa.Workflows.Management
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Management/Activities/WorkflowDefinitionActivity/PropertyNameHelper.cs
Line coverage
87%
Covered lines: 7
Uncovered lines: 1
Coverable lines: 8
Total lines: 21
Line coverage: 87.5%
Branch coverage
50%
Covered branches: 2
Total branches: 4
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
GetSafePropertyName(...)50%22100%
GetUnsafePropertyName(...)50%22100%
PrefixPropertyName(...)100%210%
RemovePropertyNamePrefix(...)100%11100%
IsReservedName(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Management/Activities/WorkflowDefinitionActivity/PropertyNameHelper.cs

#LineLine coverage
 1namespace Elsa.Workflows.Management.Activities.WorkflowDefinitionActivity;
 2
 3internal static class PropertyNameHelper
 4{
 5    public static string GetSafePropertyName(Type type, string name)
 6    {
 2567        var isReservedName = IsReservedName(type, name);
 2568        return isReservedName ? PrefixPropertyName(name) : name;
 9    }
 10
 11    public static string GetUnsafePropertyName(Type type, string name)
 12    {
 6813        var unsafeName = RemovePropertyNamePrefix(name);
 6814        var isReservedName = IsReservedName(type, unsafeName);
 6815        return isReservedName ? unsafeName : name;
 16    }
 17
 018    private static string PrefixPropertyName(string name) => $"_{name}";
 6819    private static string RemovePropertyNamePrefix(string name) => name.TrimStart('_');
 32420    private static bool IsReservedName(Type type, string name) => type.GetProperty(name) != null;
 21}