public void DictionaryEqualsTest()
        {
            // Both null
            Dictionary<int, int> dic1 = null;
            Dictionary<int, int> dic2 = null;
            Assert.IsTrue(dic1.DictionaryEquals(dic2));
            Assert.IsTrue(dic2.DictionaryEquals(dic1));

            // One null
            dic1 = new Dictionary<int, int>();
            Assert.IsFalse(dic1.DictionaryEquals(dic2));
            Assert.IsFalse(dic2.DictionaryEquals(dic1));

            // Both empty
            dic2 = new Dictionary<int, int>();
            Assert.IsTrue(dic1.DictionaryEquals(dic2));
            Assert.IsTrue(dic2.DictionaryEquals(dic1));

            // Different count
            dic1.Add(1,1);
            Assert.IsFalse(dic1.DictionaryEquals(dic2));
            Assert.IsFalse(dic2.DictionaryEquals(dic1));

            // Different key
            dic2.Add(2, 1);
            Assert.IsFalse(dic1.DictionaryEquals(dic2));
            Assert.IsFalse(dic2.DictionaryEquals(dic1));

            // Different value
            dic1.Add(2, 1);
            dic2.Add(1, 2);
            Assert.IsFalse(dic1.DictionaryEquals(dic2));
            Assert.IsFalse(dic2.DictionaryEquals(dic1));
        }
        protected override async Task DoCommitAsync()
        {
            BlobRequestOptions blobRequestOptions = Utils.GenerateBlobRequestOptions(this.destLocation.BlobRequestOptions);
            OperationContext operationContext = Utils.GenerateOperationContext(this.Controller.TransferContext);

            if (!this.destExist)
            {
                await this.pageBlob.FetchAttributesAsync(
                    Utils.GenerateConditionWithCustomerCondition(this.destLocation.AccessCondition),
                    blobRequestOptions,
                    operationContext,
                    this.CancellationToken);
            }

            var originalMetadata = new Dictionary<string, string>(this.pageBlob.Metadata);
            Utils.SetAttributes(this.pageBlob, this.SharedTransferData.Attributes);

            await this.pageBlob.SetPropertiesAsync(
                Utils.GenerateConditionWithCustomerCondition(this.destLocation.AccessCondition),
                blobRequestOptions,
                null,
                this.CancellationToken);
            
            if (!originalMetadata.DictionaryEquals(this.pageBlob.Metadata))
            {
                await this.pageBlob.SetMetadataAsync(
                             Utils.GenerateConditionWithCustomerCondition(this.destLocation.AccessCondition),
                             blobRequestOptions,
                             operationContext,
                             this.CancellationToken);
            }
        }
        protected override async Task DoCommitAsync()
        {
            FileRequestOptions fileRequestOptions = Utils.GenerateFileRequestOptions(this.destLocation.FileRequestOptions);
            OperationContext operationContext = Utils.GenerateOperationContext(this.Controller.TransferContext);

            if (!this.destExist)
            {
                await this.cloudFile.FetchAttributesAsync(
                    null,
                    fileRequestOptions,
                    operationContext,
                    this.CancellationToken);
            }

            var originalMetadata = new Dictionary<string, string>(this.cloudFile.Metadata);
            Utils.SetAttributes(this.cloudFile, this.SharedTransferData.Attributes);

            await this.cloudFile.SetPropertiesAsync(
                null,
                fileRequestOptions,
                operationContext,
                this.CancellationToken);

            if (!originalMetadata.DictionaryEquals(this.cloudFile.Metadata))
            {
                await this.cloudFile.SetMetadataAsync(
                    null,
                    fileRequestOptions,
                    operationContext,
                    this.CancellationToken);
            }
        }
        private async Task CommitAsync()
        {
            Debug.Assert(State.Commit == this.state, "Calling CommitAsync, state should be Commit");

            this.hasWork = false;

            BlobRequestOptions blobRequestOptions = Utils.GenerateBlobRequestOptions(this.location.BlobRequestOptions);
            OperationContext operationContext = Utils.GenerateOperationContext(this.Controller.TransferContext);

            if (!this.destExist)
            {
                await this.appendBlob.FetchAttributesAsync(
                    Utils.GenerateConditionWithCustomerCondition(this.location.AccessCondition),
                    blobRequestOptions,
                    operationContext,
                    this.CancellationToken);
            }

            var originalMetadata = new Dictionary<string, string>(this.appendBlob.Metadata);
            Utils.SetAttributes(this.appendBlob, this.SharedTransferData.Attributes);

            await this.appendBlob.SetPropertiesAsync(
                Utils.GenerateConditionWithCustomerCondition(this.location.AccessCondition),
                blobRequestOptions,
                operationContext,
                this.CancellationToken);

            if (!originalMetadata.DictionaryEquals(this.appendBlob.Metadata))
            {
                await this.appendBlob.SetMetadataAsync(
                             Utils.GenerateConditionWithCustomerCondition(this.location.AccessCondition),
                             blobRequestOptions,
                             operationContext,
                             this.CancellationToken);
            }

            this.SetFinish();
        }