< Summary

Class:BaseCollection[T]
Assembly:BaseVariable
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/DataStore/Variables/BaseCollection.cs
Covered lines:25
Uncovered lines:2
Coverable lines:27
Total lines:61
Line coverage:92.5% (25 of 27)
Covered branches:0
Total branches:0
Covered methods:13
Total methods:14
Method coverage:92.8% (13 of 14)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
BaseCollection()0%110100%
BaseCollection(...)0%110100%
Get()0%110100%
Clear()0%2.152066.67%
Set(...)0%220100%
Add(...)0%220100%
Remove(...)0%330100%
RemoveAt(...)0%220100%
ElementAt(...)0%110100%
Count()0%110100%
Contains(...)0%110100%
Equals(...)0%2100%

File(s)

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

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3
 4public class BaseCollection<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
 42010    internal readonly List<T> list = new List<T>();
 11
 79812    public BaseCollection() { }
 6313    public BaseCollection(IEnumerable<T> elements) { list = new List<T>(elements); }
 14
 6515    public IEnumerable<T> Get() => list;
 16
 7017    public T this[int index] { get => list[index]; set => list[index] = value; }
 18
 19    public void Clear()
 20    {
 221        list.Clear();
 222        OnSet?.Invoke(list);
 023    }
 24
 25    public void Set(IEnumerable<T> elements)
 26    {
 1427        list.Clear();
 1428        list.AddRange(elements);
 29
 1430        OnSet?.Invoke(list);
 331    }
 32
 33    public void Add(T element)
 34    {
 6235        list.Add(element);
 6236        OnAdded?.Invoke(element);
 137    }
 38
 39    public bool Remove(T element)
 40    {
 1041        if (!list.Remove(element))
 242            return false;
 43
 844        OnRemoved?.Invoke(element);
 845        return true;
 46    }
 47
 48    public void RemoveAt(int index)
 49    {
 350        T value = list[index];
 351        list.RemoveAt(index);
 352        OnRemoved?.Invoke(value);
 153    }
 54
 255    public T ElementAt(int index) => list[index];
 1156    public int Count() => list.Count;
 57
 2758    public bool Contains(T element) => list.Contains(element);
 59
 060    public virtual bool Equals(IEnumerable<T> other) { return EqualityComparer<IEnumerable<T>>.Default.Equals(list, othe
 61}