public void CanMachineLock()
        {
            var provider = new RedisJobLockProvider(_cacheClient);
            JobLock v1 = provider.Acquire("Test");
            Console.WriteLine(v1);
            Assert.True(v1.LockAcquired);

            JobLock v2 = provider.Acquire("Test");
            Console.WriteLine(v2);
            Assert.False(v2.LockAcquired);

            v1.Dispose();

            JobLock v3 = provider.Acquire("Test");
            Console.WriteLine(v3);
            Assert.True(v3.LockAcquired);

            v2.Dispose();
            v3.Dispose();
        }
Esempio n. 2
0
        public void CanMachineLock()
        {
            var     provider = new RedisJobLockProvider(_cacheClient);
            JobLock v1       = provider.Acquire("Test");

            Console.WriteLine(v1);
            Assert.True(v1.LockAcquired);

            JobLock v2 = provider.Acquire("Test");

            Console.WriteLine(v2);
            Assert.False(v2.LockAcquired);

            v1.Dispose();

            JobLock v3 = provider.Acquire("Test");

            Console.WriteLine(v3);
            Assert.True(v3.LockAcquired);

            v2.Dispose();
            v3.Dispose();
        }