Esempio n. 1
0
        public async Task CanReleaseAndAcquireAgain()
        {
            var m     = new DynamoDBMutex(RegionEndpoint.EUWest1);
            var resId = Guid.NewGuid().ToString("N");
            var t     = await m.AcquireLockAsync(resId, TimeSpan.FromSeconds(10));

            await m.ReleaseLockAsync(t);

            var t2 = await m.AcquireLockAsync(resId, TimeSpan.FromSeconds(10));

            Assert.NotNull(t2);
        }
Esempio n. 2
0
        public async Task CreatesTableCorrectly()
        {
            var m = new DynamoDBMutex(RegionEndpoint.EUWest1, new DynamoDBMutexSettings {
                TableName = "LockTestDeleteMe", CreateTableIfNotExists = true
            });
            var resId = Guid.NewGuid().ToString("N");
            var t     = await m.AcquireLockAsync(resId, TimeSpan.FromSeconds(10));

            await m.ReleaseLockAsync(t);

            var t2 = await m.AcquireLockAsync(resId, TimeSpan.FromSeconds(10));

            Assert.NotNull(t2);
        }