< Summary

Information
Class: Elsa.Expressions.JavaScript.Extensions.TypeAliasRegistryExtensions
Assembly: Elsa.Expressions.JavaScript
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions.JavaScript/Extensions/TypeAliasRegistryExtensions.cs
Line coverage
50%
Covered lines: 1
Uncovered lines: 1
Coverable lines: 2
Total lines: 22
Line coverage: 50%
Branch coverage
0%
Covered branches: 0
Total branches: 4
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
RegisterType(...)100%11100%
GetAliasOrDefault(...)0%2040%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions.JavaScript/Extensions/TypeAliasRegistryExtensions.cs

#LineLine coverage
 1using Elsa.Extensions;
 2using Elsa.Expressions.JavaScript.Contracts;
 3
 4namespace Elsa.Expressions.JavaScript.Extensions;
 5
 6/// <summary>
 7/// Extends <see cref="ITypeAliasRegistry"/>.
 8/// </summary>
 9public static class TypeAliasRegistryExtensions
 10{
 11    /// <summary>
 12    /// Register type <typeparamref name="T"/> with the specified alias.
 13    /// </summary>
 14    /// <typeparam name="T">The type to register.</typeparam>
 7615    public static void RegisterType<T>(this ITypeAliasRegistry registry, string alias) => registry.RegisterType(typeof(T
 16
 17    /// <summary>
 18    /// Returns the alias for the specified type. If no alias was found, the assembly qualified type name is returned in
 19    /// </summary>
 20    public static string GetAliasOrDefault(this ITypeAliasRegistry registry, Type type, string? defaultName = default) =
 021        registry.TryGetAlias(type, out var alias) ? alias : defaultName ?? type.GetSimpleAssemblyQualifiedName();
 22}