public void EnumerateList() { var enumerator = new ReadLockEnumerator <int>(_list, _lock); var counter = 0; while (enumerator.MoveNext()) { _list[counter++].Should().Be(enumerator.Current); } counter.Should().Be(_list.Count); enumerator.Dispose(); }
public void EnumerateDictionary() { var exists = new HashSet <int>(); var enumerator = new ReadLockEnumerator <int, int>(_dictionary.Values, _lock); while (enumerator.MoveNext()) { exists.Add(enumerator.Current).Should().BeTrue(); } exists.Count.Should().Be(_dictionary.Count); enumerator.Dispose(); }