public void Dictionary_Generic_Remove_RemoveLastEnumerationFinishes()
        {
            SegmentedDictionary <TKey, TValue> dict = (SegmentedDictionary <TKey, TValue>)GenericIDictionaryFactory(3);
            TKey key = default;

            using (var enumerator = dict.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    key = enumerator.Current.Key;
                }
            }
            using (var enumerator = dict.GetEnumerator())
            {
                enumerator.MoveNext();
                enumerator.MoveNext();
                dict.Remove(key);
                Assert.False(enumerator.MoveNext());
            }
        }
        public void Dictionary_Generic_Remove_RemoveCurrentEnumerationContinues()
        {
            SegmentedDictionary <TKey, TValue> dict = (SegmentedDictionary <TKey, TValue>)GenericIDictionaryFactory(3);

            using (var enumerator = dict.GetEnumerator())
            {
                enumerator.MoveNext();
                enumerator.MoveNext();
                dict.Remove(enumerator.Current.Key);
                Assert.True(enumerator.MoveNext());
                Assert.False(enumerator.MoveNext());
            }
        }
 internal Enumerator(SegmentedDictionary <TKey, TValue> dictionary, ReturnType returnType)
 {
     _dictionary = dictionary;
     _returnType = returnType;
     _enumerator = dictionary.GetEnumerator();
 }