Ejemplo n.º 1
0
        public void TryAddMaximum()
        {               //****************************************
            var MyCollection = new AsyncCollection <int>(1);

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

            _ = MyCollection.TryAdd(42);

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

            Assert.IsFalse(MyCollection.TryAdd(84), "Add unexpectedly succeeded");
        }
Ejemplo n.º 2
0
        public void TryAdd()
        {               //****************************************
            var MyCollection = new AsyncCollection <int>();

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

            Assert.IsTrue(MyCollection.TryAdd(42), "Failed to add");
        }
Ejemplo n.º 3
0
        public void TryPeekSuccess()
        {               //****************************************
            var MyCollection = new AsyncCollection <int>();

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

            _ = MyCollection.TryAdd(42);

            Assert.IsTrue(MyCollection.TryPeek(), "Peek failed unexpectedly");
        }
Ejemplo n.º 4
0
        public void TryAddCompleted()
        {               //****************************************
            var MyCollection = new AsyncCollection <int>(1);

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

            _ = MyCollection.CompleteAdding();

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

            Assert.IsFalse(MyCollection.TryAdd(42), "Add unexpectedly succeeded");
        }
Ejemplo n.º 5
0
        public void PeekSuccess()
        {               //****************************************
            var MyCollection = new AsyncCollection <int>();

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

            _ = MyCollection.TryAdd(42);

            var MyTask = MyCollection.Peek();

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

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