public void WhenCollectionHasItems_ConsumerEnumerableShouldGetAllItemsAndBlocked()
        {
            using (var sut = new SimpleBlockingCollection <int>())
            {
                sut.Add(10);
                sut.Add(20);

                using (var enumerator = sut.GetConsumingEnumerable().GetEnumerator())
                {
                    enumerator.MoveNext();
                    Assert.AreEqual(enumerator.Current, 10);
                    enumerator.MoveNext();
                    Assert.AreEqual(enumerator.Current, 20);

                    ConcurrentAssert.EnsureThatActionIsNeverCompleted(() => enumerator.MoveNext());
                }
            }
        }
        public void WhenCollectionHasItems_ConsumerEnumerableShouldGetAllItemsEvenIfCompleted()
        {
            using (var sut = new SimpleBlockingCollection <int>())
            {
                sut.Add(10);
                sut.Add(20);

                using (var enumerator = sut.GetConsumingEnumerable().GetEnumerator())
                {
                    enumerator.MoveNext();
                    Assert.AreEqual(enumerator.Current, 10);

                    sut.CompleteAdding();

                    enumerator.MoveNext();
                    Assert.AreEqual(enumerator.Current, 20);

                    Assert.IsFalse(enumerator.MoveNext());
                }
            }
        }