public void ReadLockExisting() { IScopeProvider provider = ScopeProvider; using (IScope scope = provider.CreateScope()) { scope.EagerReadLock(Constants.Locks.Servers); scope.Complete(); } }
public void ReadLockNonExisting() { var lockingMechanism = GetRequiredService <IDistributedLockingMechanismFactory>().DistributedLockingMechanism; if (lockingMechanism is SqliteDistributedLockingMechanism) { Assert.Ignore("SqliteDistributedLockingMechanism doesn't query the umbracoLock table for read locks."); } IScopeProvider provider = ScopeProvider; Assert.Throws <ArgumentException>(() => { using (IScope scope = provider.CreateScope()) { scope.EagerReadLock(-666); scope.Complete(); } }); }