Пример #1
0
        public void TryAddMaximum()
        {               //****************************************
            var MyCollection = new AsyncCollection <int>(1);

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

            _ = MyCollection.TryAdd(42);

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

            Assert.IsFalse(MyCollection.TryAdd(84), "Add unexpectedly succeeded");
        }
Пример #2
0
        public void TryAdd()
        {               //****************************************
            var MyCollection = new AsyncCollection <int>();

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

            Assert.IsTrue(MyCollection.TryAdd(42), "Failed to add");
        }
Пример #3
0
        public void TryPeekSuccess()
        {               //****************************************
            var MyCollection = new AsyncCollection <int>();

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

            _ = MyCollection.TryAdd(42);

            Assert.IsTrue(MyCollection.TryPeek(), "Peek failed unexpectedly");
        }
Пример #4
0
        public void TryAddCompleted()
        {               //****************************************
            var MyCollection = new AsyncCollection <int>(1);

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

            _ = MyCollection.CompleteAdding();

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

            Assert.IsFalse(MyCollection.TryAdd(42), "Add unexpectedly succeeded");
        }
Пример #5
0
        public void PeekSuccess()
        {               //****************************************
            var MyCollection = new AsyncCollection <int>();

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

            _ = MyCollection.TryAdd(42);

            var MyTask = MyCollection.Peek();

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

            Assert.IsTrue(MyTask.IsCompleted, "Peek failed unexpectedly");
        }