public void GetConsumingEnumerableReturnsItemsInOrder()
 {
     var collection = new BusyBlockingCollection<int>();
     collection.Add(1);
     collection.Add(2);
     collection.Add(3);
     collection.CompleteAdding();
     CollectionAssert.AreEquivalent(new[]{1,2,3}, collection.GetConsumingEnumerable());
 }
Example #2
0
        public void GetConsumingEnumerableReturnsItemsInOrder()
        {
            var collection = new BusyBlockingCollection <int>();

            collection.Add(1);
            collection.Add(2);
            collection.Add(3);
            collection.CompleteAdding();
            CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, collection.GetConsumingEnumerable());
        }
 public void WaitForProcessingCompletedDuringGetConsumingEnumerable()
 {
     var collection = new BusyBlockingCollection<int>();
     collection.Add(1);
     collection.Add(2);
     collection.Add(3);
     collection.CompleteAdding();
     Assert.IsFalse(collection.WaitHandle.WaitOne(0));
     foreach (var item in collection.GetConsumingEnumerable())
     {
         Assert.IsFalse(collection.WaitHandle.WaitOne(0));
     }
     Assert.IsTrue(collection.WaitHandle.WaitOne(0));
 }
Example #4
0
        public void WaitForProcessingCompletedDuringGetConsumingEnumerable()
        {
            var collection = new BusyBlockingCollection <int>();

            collection.Add(1);
            collection.Add(2);
            collection.Add(3);
            collection.CompleteAdding();
            Assert.IsFalse(collection.WaitHandle.WaitOne(0));
            foreach (var item in collection.GetConsumingEnumerable())
            {
                Assert.IsFalse(collection.WaitHandle.WaitOne(0));
            }
            Assert.IsTrue(collection.WaitHandle.WaitOne(0));
        }