public void ReleaseResourceAllowsGettingNewLock()
        {
            var azureBlobContainer = new TestAzureBlobContainer(
                CloudConfiguration.GetStorageAccount("DataConnectionString"),
                AzureBlobTestContainer);

            var objId = Guid.NewGuid().ToString();

            azureBlobContainer.Save(objId, "testText");

            var lockContext = new PessimisticConcurrencyContext()
            {
                ObjectId = objId
            };

            Assert.IsTrue(azureBlobContainer.AcquireLock(lockContext));
            Assert.IsNotNull(lockContext.LockId);
            var firstLockId = lockContext.LockId;

            azureBlobContainer.ReleaseLock(lockContext);

            Assert.IsTrue(azureBlobContainer.AcquireLock(lockContext));
            Assert.IsNotNull(lockContext.LockId);
            Assert.AreNotEqual(firstLockId, lockContext.LockId);
        }
        public void LockAndWriteResource()
        {
            var azureBlobContainer = new TestAzureBlobContainer(
                CloudConfiguration.GetStorageAccount("DataConnectionString"),
                AzureBlobTestContainer);

            var objId = Guid.NewGuid().ToString();

            azureBlobContainer.Save(objId, "testText");

            var context = new PessimisticConcurrencyContext()
            {
                ObjectId = objId
            };

            try
            {
                azureBlobContainer.AcquireLock(context);
                azureBlobContainer.Save(context, "testTextUpdated");
            }
            finally
            {
                azureBlobContainer.ReleaseLock(context);
            }

            Assert.AreEqual("testTextUpdated", azureBlobContainer.Get(objId));
        }