< Summary

Information
Class: Elsa.Expressions.JavaScript.Helpers.ObjectArrayHelper
Assembly: Elsa.Expressions.JavaScript
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions.JavaScript/Helpers/ObjectArrayHelper.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 39
Line coverage: 100%
Branch coverage
100%
Covered branches: 12
Total branches: 12
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
DetermineIfObjectIsArrayLikeClrCollection(...)100%1212100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions.JavaScript/Helpers/ObjectArrayHelper.cs

#LineLine coverage
 1using System.Collections;
 2
 3namespace Elsa.Expressions.JavaScript.Helpers;
 4
 5/// <summary>
 6/// Contains helper methods for working with object arrays.
 7/// </summary>
 8public static class ObjectArrayHelper
 9{
 10    /// <summary>
 11    /// Determines if the specified object is an array-like CLR collection.
 12    /// </summary>
 13    public static bool DetermineIfObjectIsArrayLikeClrCollection(Type type)
 14    {
 34015        var isDictionary = typeof(IDictionary).IsAssignableFrom(type);
 16
 34017        if (isDictionary)
 118            return false;
 19
 33920        if (typeof(ICollection).IsAssignableFrom(type))
 521            return true;
 22
 227323        foreach (var interfaceType in type.GetInterfaces())
 24        {
 96125            if (!interfaceType.IsGenericType)
 26            {
 27                continue;
 28            }
 29
 64930            if (interfaceType.GetGenericTypeDefinition() == typeof(IReadOnlyCollection<>)
 64931                || interfaceType.GetGenericTypeDefinition() == typeof(ICollection<>))
 32            {
 31733                return true;
 34            }
 35        }
 36
 1737        return false;
 38    }
 39}