internal void CopyBlobTestGB(Agent agent, StorageBlob.BlobType blobType) { string uploadFilePath = @".\" + Utility.GenNameString("gbupload"); string srcContainerName = Utility.GenNameString("gbupload-", 15); string destContainerName = Utility.GenNameString("gbupload-", 15); string blobName = Path.GetFileName(uploadFilePath); // create the container CloudBlobContainer srcContainer = blobUtil.CreateContainer(srcContainerName); CloudBlobContainer destContainer = blobUtil.CreateContainer(destContainerName); // Generate a 512 bytes file which contains GB18030 characters File.WriteAllText(uploadFilePath, GB18030String); string localMd5 = Helper.GetFileContentMD5(uploadFilePath); try { // create source blob ICloudBlob blob = CloudBlobUtil.GetBlob(srcContainer, blobName, blobType); // upload file data using (var fileStream = System.IO.File.OpenRead(uploadFilePath)) { blob.UploadFromStream(fileStream); // need to set MD5 as for page blob, it won't set MD5 automatically blob.Properties.ContentMD5 = localMd5; blob.SetProperties(); } //--------------Copy blob operation-------------- Test.Assert(agent.StartAzureStorageBlobCopy(srcContainerName, blobName, destContainerName, blobName), Utility.GenComparisonData("Start copy blob using blob name", true)); // Get destination blob blob = CloudBlobUtil.GetBlob(destContainer, blobName, blobType); // Check MD5 blob.FetchAttributes(); Test.Assert(localMd5 == blob.Properties.ContentMD5, string.Format("blob content md5 should be {0}, and actualy it's {1}", localMd5, blob.Properties.ContentMD5)); } finally { // cleanup srcContainer.DeleteIfExists(); destContainer.DeleteIfExists(); File.Delete(uploadFilePath); } }