< Summary

Information
Class: Elsa.Workflows.ChangeTrackingDictionary<T1, T2>
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Models/ChangeTrackingDictionary.cs
Line coverage
9%
Covered lines: 1
Uncovered lines: 10
Coverable lines: 11
Total lines: 27
Line coverage: 9%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Add(...)100%210%
Remove(...)0%620%
get_Item(...)100%210%
set_Item(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Models/ChangeTrackingDictionary.cs

#LineLine coverage
 1namespace Elsa.Workflows;
 2
 141763public class ChangeTrackingDictionary<TKey, TValue>(Action onChange) : Dictionary<TKey, TValue> where TKey : notnull
 4{
 5    public new void Add(TKey key, TValue value)
 6    {
 07        base.Add(key, value);
 08        onChange();
 09    }
 10
 11    public new bool Remove(TKey key)
 12    {
 013        var result = base.Remove(key);
 014        if (result) onChange();
 015        return result;
 16    }
 17
 18    public new TValue this[TKey key]
 19    {
 020        get => base[key];
 21        set
 22        {
 023            base[key] = value;
 024            onChange();
 025        }
 26    }
 27}