< Summary

Information
Class: Fluorite.Strainer.Collections.ReadOnlyHashSet<T>
Assembly: Fluorite.Strainer
File(s): /builds/fluorite/strainer/src/Strainer/Collections/ReadOnlyHashSet.cs
Line coverage
30%
Covered lines: 4
Uncovered lines: 9
Coverable lines: 13
Total lines: 57
Line coverage: 30.7%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_Count()100%210%
Contains(...)100%11100%
GetEnumerator()100%210%
IsProperSubsetOf(...)100%210%
IsProperSupersetOf(...)100%210%
IsSubsetOf(...)100%210%
IsSupersetOf(...)100%210%
Overlaps(...)100%210%
SetEquals(...)100%210%
System.Collections.Generic.IEnumerable<T>.GetEnumerator()100%210%

File(s)

/builds/fluorite/strainer/src/Strainer/Collections/ReadOnlyHashSet.cs

#LineLine coverage
 1using System.Collections;
 2using System.Diagnostics;
 3
 4namespace Fluorite.Strainer.Collections;
 5
 6/// <summary>
 7/// Represents a read-only set of values.
 8/// </summary>
 9/// <typeparam name="T">
 10/// The type of elements in the hash set.
 11/// </typeparam>
 12[DebuggerDisplay(nameof(Count) + " = {" + nameof(Count) + ",nq}")]
 13public class ReadOnlyHashSet<T> : IReadOnlySet<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable
 14{
 15    private readonly HashSet<T> _set;
 16
 17    /// <summary>
 18    /// Initializes a new instance of the <see cref="ReadOnlyHashSet{T}"/> class
 19    /// with elements copied from specified collection.
 20    /// </summary>
 21    /// <param name="collection">
 22    /// The collection of values that will create base for this hash set.
 23    /// </param>
 1424    public ReadOnlyHashSet(IEnumerable<T> collection)
 25    {
 1426        _set = new HashSet<T>(Guard.Against.Null(collection));
 1427    }
 28
 29    /// <inheritdoc/>
 030    public int Count => _set.Count;
 31
 32    /// <inheritdoc/>
 16333    public bool Contains(T item) => _set.Contains(item);
 34
 35    /// <inheritdoc/>
 036    public IEnumerator GetEnumerator() => _set.GetEnumerator();
 37
 38    /// <inheritdoc/>
 039    public bool IsProperSubsetOf(IEnumerable<T> other) => _set.IsProperSubsetOf(other);
 40
 41    /// <inheritdoc/>
 042    public bool IsProperSupersetOf(IEnumerable<T> other) => _set.IsProperSupersetOf(other);
 43
 44    /// <inheritdoc/>
 045    public bool IsSubsetOf(IEnumerable<T> other) => _set.IsSubsetOf(other);
 46
 47    /// <inheritdoc/>
 048    public bool IsSupersetOf(IEnumerable<T> other) => _set.IsSupersetOf(other);
 49
 50    /// <inheritdoc/>
 051    public bool Overlaps(IEnumerable<T> other) => _set.Overlaps(other);
 52
 53    /// <inheritdoc/>
 054    public bool SetEquals(IEnumerable<T> other) => _set.SetEquals(other);
 55
 056    IEnumerator<T> IEnumerable<T>.GetEnumerator() => _set.GetEnumerator();
 57}