public void LockAfterAllThreadsDecrementAndOneThreadDecrementsASecondTime(int aThreadIndex, int bThreadIndex)
        {
            var primitive = new ThreadingPrimitive(2);

            Assert.That(async() => await RunWithTimeout(
                            () =>
            {
                primitive.DecrementAndWait(aThreadIndex);
                primitive.DecrementAndWait(aThreadIndex);
            },
                            () => primitive.DecrementAndWait(bThreadIndex)), Throws.TypeOf <TimeoutException>());
        }
        public void ShouldContinueAfterMultipleThreadsDecrement(int[] threadIds)
        {
            var primitive = new ThreadingPrimitive(10);

            Assert.That(async() => await RunWithTimeout(
                            () => primitive.DecrementAndWait(threadIds[0]),
                            () => primitive.DecrementAndWait(threadIds[1]),
                            () => primitive.DecrementAndWait(threadIds[2]),
                            () => primitive.DecrementAndWait(threadIds[3]),
                            () => primitive.DecrementAndWait(threadIds[4]),
                            () => primitive.DecrementAndWait(threadIds[5]),
                            () => primitive.DecrementAndWait(threadIds[6]),
                            () => primitive.DecrementAndWait(threadIds[7]),
                            () => primitive.DecrementAndWait(threadIds[8]),
                            () => primitive.DecrementAndWait(threadIds[9])), Throws.Nothing);
        }
        public void Continue()
        {
            var primitive = new ThreadingPrimitive(1);

            Assert.That(async() => await RunWithTimeout(() => primitive.DecrementAndWait(0)), Throws.Nothing);
        }
        public void Lock(int threadIndex)
        {
            var primitive = new ThreadingPrimitive(2);

            Assert.That(async() => await RunWithTimeout(() => primitive.DecrementAndWait(threadIndex)), Throws.TypeOf <TimeoutException>());
        }