예제 #1
0
        public async Task LockManager_ConfirmLockingIsSingleEntry()
        {
            LockRelease lck = LockManager.GetLock(LockType.OfferCreated);

            Assert.Equal(1, lck.LockCurrentCount);

            await lck.Lock();

            Assert.Equal(0, lck.LockCurrentCount);

            var type = typeof(Exception);
            await Assert.ThrowsAsync(type, () => lck.Lock(0));
        }
예제 #2
0
        public async Task LockManager_ConfirmLockingWorks()
        {
            LockRelease lck = LockManager.GetLock(LockType.OfferCreated);

            Assert.Equal(1, lck.LockCurrentCount);

            await lck.Lock();

            Assert.Equal(0, lck.LockCurrentCount);

            lck.Dispose();

            Assert.Equal(1, lck.LockCurrentCount);
        }