public void ExitListLock() { var enumerator = new ReadLockWhereEnumerator <int, int>(_list, _stub, 0, _lock); enumerator.Dispose(); _lock.IsReadLockHeld.Should().BeFalse(); }
public void ExitDictionaryLock() { var enumerator = new ReadLockWhereEnumerator <int, int, int>(_dictionary.Values, _stub, 0, _lock); enumerator.Dispose(); _lock.IsReadLockHeld.Should().BeFalse(); }
public void EnumerateListAsEnumerator() { var exists = new HashSet <int>(); var lockEnumerator = new ReadLockWhereEnumerator <int, int>(_list, _stub, 0, _lock); var enumerator = ((IEnumerable)lockEnumerator).GetEnumerator(); while (enumerator.MoveNext()) { exists.Add((int)enumerator.Current !).Should().BeTrue(); } exists.Count.Should().Be(_list.Count); }
public void EnumerateList() { var exists = new HashSet <int>(); var enumerator = new ReadLockWhereEnumerator <int, int>(_list, _stub, 0, _lock); while (enumerator.MoveNext()) { exists.Add(enumerator.Current).Should().BeTrue(); } exists.Count.Should().Be(_list.Count); enumerator.Dispose(); }
public void FilterListValues() { var exists = new HashSet <int>(); var greatestValue = _list.Max(); var enumerator = new ReadLockWhereEnumerator <int, int>(_list, (v, arg) => v >= arg, greatestValue, _lock); while (enumerator.MoveNext()) { exists.Add(enumerator.Current).Should().BeTrue(); } exists.Count.Should().Be(1); exists.Should().ContainSingle(v => v == greatestValue); enumerator.Dispose(); }
public void EnterListLock() { var _ = new ReadLockWhereEnumerator <int, int>(_list, _stub, 0, _lock); _lock.IsReadLockHeld.Should().BeTrue(); }
public void EnterDictionaryLock() { var _ = new ReadLockWhereEnumerator <int, int, int>(_dictionary.Values, _stub, 0, _lock); _lock.IsReadLockHeld.Should().BeTrue(); }