< Summary

Information
Class: Pozitron.QuerySpecification.Iterator<T>
Assembly: Pozitron.QuerySpecification
File(s): /home/runner/work/QuerySpecification/QuerySpecification/src/QuerySpecification/Internals/Iterator.cs
Tag: 52_11740816328
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 36
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
GetEnumerator()100%44100%
get_Current()100%11100%
System.Collections.IEnumerator.get_Current()100%11100%
System.Collections.Generic.IEnumerable<TSource>.GetEnumerator()100%11100%
System.Collections.IEnumerable.GetEnumerator()100%11100%
Dispose()100%11100%

File(s)

/home/runner/work/QuerySpecification/QuerySpecification/src/QuerySpecification/Internals/Iterator.cs

#LineLine coverage
 1using System.Collections;
 2using System.Diagnostics.CodeAnalysis;
 3
 4namespace Pozitron.QuerySpecification;
 5
 6internal abstract class Iterator<TSource> : IEnumerable<TSource>, IEnumerator<TSource>
 7{
 2198    private readonly int _threadId = Environment.CurrentManagedThreadId;
 9
 10    private protected int _state;
 11    private protected TSource _current = default!;
 12
 13    public Iterator<TSource> GetEnumerator()
 14    {
 21915        var enumerator = _state == 0 && _threadId == Environment.CurrentManagedThreadId ? this : Clone();
 21916        enumerator._state = 1;
 21917        return enumerator;
 18    }
 19
 20    public abstract Iterator<TSource> Clone();
 21    public abstract bool MoveNext();
 22
 37823    public TSource Current => _current;
 224    object? IEnumerator.Current => Current;
 21825    IEnumerator<TSource> IEnumerable<TSource>.GetEnumerator() => GetEnumerator();
 126    IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
 27
 28    [ExcludeFromCodeCoverage]
 29    void IEnumerator.Reset() => throw new NotSupportedException();
 30
 31    public virtual void Dispose()
 32    {
 34233        _current = default!;
 34234        _state = -1;
 34235    }
 36}