public async Task TestWaitForLockTimeoutAsync() { using (var manager = LockManagerFactory.Create(() => TestDbContext.Create())) { var resource = new Guid("3767EF33-8296-4363-95CE-120E0453E3D0"); LockInfo lockInfo = await manager.TryLockAsync(resource, TimeSpan.FromMinutes(5)); Assert.True(lockInfo.AsImmutable().HasLock()); LockInfo lockInfo2 = await manager.WaitForLockAsync(resource, TimeSpan.FromMinutes(1), TimeSpan.FromMilliseconds(50)); Assert.False(lockInfo2.AsImmutable().HasLock()); //Already cancelled token LockInfo lockInfo3 = await manager.WaitForLockAsync(resource, TimeSpan.FromMinutes(1), TimeSpan.Zero); Assert.False(lockInfo3.AsImmutable().HasLock()); await manager.ReleaseAsync(lockInfo); await manager.ReleaseAsync(lockInfo2); await manager.ReleaseAsync(lockInfo3); } }