public void Add()
        {         //****************************************
            var MyCounter = new AsyncCounter();

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

            MyCounter.Add(10);

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

            Assert.AreEqual(10, MyCounter.CurrentCount, "Counter not incremented");
            Assert.AreEqual(0, MyCounter.WaitingCount, "Tasks unexpectedly waiting");
        }
        public void AddDecrement()
        {         //****************************************
            var MyCounter = new AsyncCounter();

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

            MyCounter.Add(10);

            var MyTask = MyCounter.Decrement();

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

            Assert.IsTrue(MyTask.IsCompleted, "Still waiting to decrement");

            Assert.AreEqual(9, MyCounter.CurrentCount, "Counter not decremented");
            Assert.AreEqual(0, MyCounter.WaitingCount, "Tasks unexpectedly waiting");
        }
        public async Task DecrementToZeroAdd()
        {         //****************************************
            var MyCounter = new AsyncCounter();
            //****************************************

            var MyTask = MyCounter.DecrementToZero();

            Assert.IsFalse(MyTask.IsCompleted, "Decremented too early");

            MyCounter.Add(10);

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

            Assert.AreEqual(10, await MyTask);

            Assert.AreEqual(0, MyCounter.CurrentCount, "Counter not decremented");
            Assert.AreEqual(0, MyCounter.WaitingCount, "Tasks unexpectedly waiting");
        }