public void LockHandler_RefreshLock_Test() { Node node = CreateTestPage(); LockHandler target = new LockHandler(node); if (!target.Locked) { target.Lock(); } long time = GetNodeInfo_LastLockUpdate(node).Ticks; Thread.Sleep(10); target.RefreshLock(); Assert.IsTrue(GetNodeInfo_LastLockUpdate(node).Ticks > time); }
public void LockHandler_Lock_Test() { Node node = CreateTestPage(); LockHandler target = new LockHandler(node); if (target.Locked) { target.Unlock(VersionStatus.Approved, VersionRaising.None); } target.Lock(); Assert.IsTrue( !(string.IsNullOrEmpty(GetNodeInfo_LockToken(node))) && GetNodeInfo_LockedById(node) == User.Current.Id && GetNodeInfo_LockDate(node) != DateTime.MinValue && GetNodeInfo_LastLockUpdate(node) != DateTime.MinValue && GetNodeInfo_LockTimeout(node) > 0 ); }
public void LockHandler_Unlock_Test() { Node node = CreateTestPage(); LockHandler target = new LockHandler(node); if (!target.Locked) { target.Lock(); } target.Unlock(VersionStatus.Approved, VersionRaising.None); Assert.IsTrue(!GetNodeInfo_Locked(node)); }
public void LockHandler_Lock_LockedTest() { Node node = CreateTestPage(); LockHandler target = new LockHandler(node); target.Lock(); DateTime dt1 = target.LastLockUpdate; Thread.Sleep(10); target.Lock(); DateTime dt2 = target.LastLockUpdate; Assert.IsTrue(dt1 < dt2); }
public LockedNodeException(LockHandler lockHandler, string message) : base(message) { this._lockHandler = lockHandler; }
public LockedNodeException(LockHandler lockHandler) : base(String.Concat(lockHandler.Node.Path, ": is locked.")) { this._lockHandler = lockHandler; }