< Summary

Information
Class: Elsa.Extensions.StringValueExtensions
Assembly: Elsa.Http
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/Extensions/StringValueExtensions.cs
Line coverage
100%
Covered lines: 5
Uncovered lines: 0
Coverable lines: 5
Total lines: 24
Line coverage: 100%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
ToObjectDictionary(...)50%22100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/Extensions/StringValueExtensions.cs

#LineLine coverage
 1using Microsoft.Extensions.Primitives;
 2
 3// ReSharper disable once CheckNamespace
 4namespace Elsa.Extensions;
 5
 6/// <summary>
 7/// Contains extension methods for the <see cref="StringValues"/> Enumerable dictonaries.
 8/// </summary>
 9public static class StringValueExtensions
 10{
 11    /// <summary>
 12    /// Convert the collection to the desired dictionary type.
 13    /// </summary>
 14    /// <param name="collection"></param>
 15    /// <returns></returns>
 16    public static Dictionary<string, object> ToObjectDictionary(this IEnumerable<KeyValuePair<string, StringValues>> col
 17    {
 42818        return collection.ToDictionary<KeyValuePair<string, StringValues>, string, object>(
 83619            item => item.Key,
 126420            item => item.Value.Count <= 1 ?
 126421            item.Value[0]!
 126422            : item.Value.ToArray());
 23    }
 24}