Пример #1
0
        public void ShouldFailForDoubleLeave()
        {
            var @lock = new SlimLock();

            @lock.Enter();
            @lock.Leave();
            Assert.Catch <Exception>(() => @lock.Leave(), "Enter/Leave should have balance");
        }
Пример #2
0
        public void ShouldEnterAndLeaveInSingleThreadWithTry()
        {
            var @lock = new SlimLock();

            Assert.IsTrue(@lock.TryEnter());
            @lock.Leave();
        }
Пример #3
0
        public void ShouldEnterAndLeaveInSingleThread()
        {
            var @lock = new SlimLock();

            @lock.Enter();
            @lock.Leave();
        }