< Summary

Information
Class: IceRpc.Internal.DictionaryExtensions
Assembly: IceRpc
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc/Internal/DictionaryExtensions.cs
Tag: 275_13775359185
Line coverage
100%
Covered lines: 13
Uncovered lines: 0
Coverable lines: 13
Total lines: 32
Line coverage: 100%
Branch coverage
90%
Covered branches: 9
Total branches: 10
Branch coverage: 90%
Method coverage
100%
Covered methods: 1
Total methods: 1
Method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
DictionaryEqual(...)90%1010100%

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc/Internal/DictionaryExtensions.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3namespace IceRpc.Internal;
 4
 5/// <summary>Extension methods for dictionaries.</summary>
 6internal static class DictionaryExtensions
 7{
 8    /// <summary>Checks if two dictionaries are equal. The order of the elements in the dictionaries does not
 9    /// matter.</summary>
 10    internal static bool DictionaryEqual<TKey, TValue>(
 11        this IReadOnlyDictionary<TKey, TValue> lhs,
 12        IReadOnlyDictionary<TKey, TValue> rhs,
 13        IEqualityComparer<TValue>? valueComparer = null)
 169114    {
 169115        if (rhs.Count != lhs.Count)
 216        {
 217            return false;
 18        }
 19
 168920        valueComparer ??= EqualityComparer<TValue>.Default;
 21
 529122        foreach ((TKey key, TValue value) in lhs)
 11523        {
 11524            if (!rhs.TryGetValue(key, out TValue? otherValue) || !valueComparer.Equals(value, otherValue))
 625            {
 626                return false;
 27            }
 10928        }
 29
 168330        return true;
 169131    }
 32}