public void Managing_pending_locks()
        {
            var log = A.Fake <IEventsLog>();


            ILockManager lockManager = new LockManager(log);

            var sessionId = Guid.NewGuid();

            lockManager.AcquireLock(sessionId, false, "x", "y", "z");

            Assert.AreEqual(3, lockManager.GetCurrentlyHoldLocks());

            Assert.IsTrue(lockManager.CheckLock(sessionId, false, "x", "y", "z"));

            // false because it is a read-only lock
            Assert.False(lockManager.CheckLock(sessionId, true, "x", "y", "z"));

            lockManager.CloseSession(sessionId);

            Assert.AreEqual(0, lockManager.GetCurrentlyHoldLocks());

            // session no longer active
            Assert.IsFalse(lockManager.CheckLock(sessionId, false, "x", "y", "z"));


            lockManager.AcquireLock(sessionId, true, "tony", "tara");
            Assert.AreEqual(2, lockManager.GetCurrentlyHoldLocks());


            Thread.Sleep(500);

            Assert.AreEqual(2, lockManager.GetCurrentlyHoldLocks(100));

            var locks = lockManager.ForceRemoveAllLocks(100);

            A.CallTo(() => log.LogEvent(EventType.LockRemoved, null, 0)).MustHaveHappened();

            Assert.AreEqual(2, locks);

            Assert.AreEqual(0, lockManager.GetCurrentlyHoldLocks());
        }