Пример #1
0
        public void TryTakeFromAnyEmpty()
        {               //****************************************
            var MyCollections = new AsyncCollection <int>[] { new AsyncCollection <int>(), new AsyncCollection <int>() };
            //****************************************

            var MyResult = AsyncCollection <int> .TryTakeFromAny(MyCollections);

            //****************************************

            Assert.IsFalse(MyResult.HasItem, "Take succeeded unexpectedly");
        }
Пример #2
0
        public async Task TryTakeFromAny([Values(0, 1)] int index)
        {               //****************************************
            var MyCollections = new AsyncCollection <int>[] { new AsyncCollection <int>(), new AsyncCollection <int>() };
            //****************************************

            await MyCollections[index].Add(42);

            var MyResult = AsyncCollection <int> .TryTakeFromAny(MyCollections);

            //****************************************

            Assert.IsTrue(MyResult.HasItem, "Take failed unexpectedly");
            Assert.AreSame(MyCollections[index], MyResult.Source, "Collection was not as expected");
            Assert.AreEqual(42, MyResult.Item, "Item was not as expected");
        }