< Summary

Class:BaseHashSet[T]
Assembly:DataStore
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/DataStore/Variables/BaseHashSet.cs
Covered lines:9
Uncovered lines:9
Coverable lines:18
Total lines:45
Line coverage:50% (9 of 18)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
BaseHashSet()0%110100%
BaseHashSet(...)0%2100%
Get()0%2100%
Set(...)0%6200%
Add(...)0%220100%
Remove(...)0%3.143075%
Count()0%2100%
Contains(...)0%110100%
Equals(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/DataStore/Variables/BaseHashSet.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3
 4public class BaseHashSet<T> : IBaseCollection<T>, IEquatable<IEnumerable<T>>
 5{
 6    public event Action<IEnumerable<T>> OnSet;
 7    public event Action<T> OnAdded;
 8    public event Action<T> OnRemoved;
 9
 41610    internal readonly HashSet<T> hashSet = new HashSet<T>();
 11
 83212    public BaseHashSet() { }
 013    public BaseHashSet(IEnumerable<T> elements) { hashSet = new HashSet<T>(elements); }
 14
 015    public IEnumerable<T> Get() => hashSet;
 16
 17    public void Set(IEnumerable<T> elements)
 18    {
 019        hashSet.Clear();
 020        hashSet.UnionWith(elements);
 21
 022        OnSet?.Invoke(hashSet);
 023    }
 24
 25    public void Add(T element)
 26    {
 27827        hashSet.Add(element);
 27828        OnAdded?.Invoke(element);
 27829    }
 30
 31    public bool Remove(T element)
 32    {
 27133        if (!hashSet.Remove(element))
 034            return false;
 35
 27136        OnRemoved?.Invoke(element);
 27137        return true;
 38    }
 39
 040    public int Count() => hashSet.Count;
 41
 54942    public bool Contains(T element) => hashSet.Contains(element);
 43
 044    public virtual bool Equals(IEnumerable<T> other) { return EqualityComparer<IEnumerable<T>>.Default.Equals(hashSet, o
 45}