public void Lock(ITableCategory category, TaskContext context) { category.Dispatcher.Invoke(() => { if (category.Parent == null) { return; } var comment = RandomUtility.NextString(); if (Verify(comment) == false) { return; } category.Lock(context.Authentication, comment); }); bool Verify(string comment) { if (context.AllowException == true) { return(true); } if (comment == string.Empty) { return(false); } if (category.IsLocked == true) { return(false); } return(true); } }
public void CategoryLockRenameTest() { cremaHost.Dispatcher.Invoke(() => { var newName = RandomUtility.NextIdentifier(); category.Lock(authentication, string.Empty); category.Rename(authentication, newName); Assert.AreEqual(category.Path, category.LockInfo.Path); }); }
public static void LockFailTest <T>(ICremaHost cremaHost, ITableCategory category, Authentication authentication) where T : Exception { cremaHost.Dispatcher.Invoke(() => { try { category.Lock(authentication, string.Empty); Assert.Fail("Lock"); } catch (T) { } }); }
public static void LockFailTest <T>(ITableCategory category, Authentication authentication) where T : Exception { Assert.AreNotEqual(null, category.Parent); category.Dispatcher.Invoke(() => { try { category.Lock(authentication, RandomUtility.NextString()); Assert.Fail("LockFailTest"); } catch (T) { } }); }
public void Lock() { category.Lock(authentication, RandomUtility.NextString()); }