< Summary

Information
Class: Fluorite.Extensions.EnumerableExtensions
Assembly: Fluorite.Strainer
File(s): /builds/fluorite/strainer/src/Strainer/Extensions/EnumerableExtensions.cs
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 47
Line coverage: 100%
Branch coverage
100%
Covered branches: 8
Total branches: 8
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Concat(...)100%22100%
Merge(...)100%22100%
ToDictionary(...)100%44100%
ToReadOnlyDictionary(...)100%11100%

File(s)

/builds/fluorite/strainer/src/Strainer/Extensions/EnumerableExtensions.cs

#LineLine coverage
 1using System.Collections.ObjectModel;
 2
 3namespace Fluorite.Extensions;
 4
 5public static class EnumerableExtensions
 6{
 7    public static IEnumerable<T> Concat<T>(
 8        this IEnumerable<T> source,
 9        params IEnumerable<T>[] sequences)
 10    {
 211        Guard.Against.Null(source);
 212        Guard.Against.Null(sequences);
 13
 1014        return Enumerable.Concat(source, sequences.SelectMany(x => x));
 15    }
 16
 17    public static Dictionary<TKey, TValue> Merge<TKey, TValue>(
 18        this IEnumerable<KeyValuePair<TKey, TValue>> keyValuePairs)
 19    {
 5220        Guard.Against.Null(keyValuePairs);
 21
 5222        var result = new Dictionary<TKey, TValue>();
 23
 12424        foreach (var pair in keyValuePairs)
 25        {
 1026            result.Add(pair.Key, pair.Value);
 27        }
 28
 5229        return result;
 30    }
 31
 32    public static Dictionary<TKey, TValue> ToDictionary<TKey, TValue>(
 33        this IEnumerable<KeyValuePair<TKey, TValue>> source)
 34    {
 1235        Guard.Against.Null(source);
 36
 45437        return source.ToDictionary(pair => pair.Key, pair => pair.Value);
 38    }
 39
 40    public static ReadOnlyDictionary<TKey, TValue> ToReadOnlyDictionary<TKey, TValue>(
 41        this IEnumerable<KeyValuePair<TKey, TValue>> source)
 42    {
 1243        Guard.Against.Null(source);
 44
 1245        return new ReadOnlyDictionary<TKey, TValue>(source.ToDictionary());
 46    }
 47}