コード例 #1
0
        public void AssertBlobCopyPropertiesMatch(string containerName, string blobName, Communications.Common.CopyStatus? copyStatus, Basic.Azure.Storage.Communications.BlobService.BlobCopyProgress copyProgress, DateTime? copyCompletionTime, string copyStatusDescription, string copyId, string copySource)
        {
            var client = _storageAccount.CreateCloudBlobClient();
            var container = client.GetContainerReference(containerName);
            if (!container.Exists())
                Assert.Fail("AssertBlobCopyPropertiesMatch: The container '{0}' does not exist", containerName);

            var blob = container.GetBlobReferenceFromServer(blobName);
            if (!blob.Exists())
                Assert.Fail("AssertBlobCopyPropertiesMatch: The blob '{0}' does not exist", blobName);

            var copyState = blob.CopyState;

            if (null == copyState)
            {
                Assert.IsNull(copyStatus);
                Assert.IsNull(copyProgress);
                Assert.IsNull(copyCompletionTime);
                Assert.IsNull(copyStatusDescription);
                Assert.IsNull(copyId);
                Assert.IsNull(copySource);
            }
            else
            {
                Assert.AreEqual(copyState.Status.ToString(), copyStatus.ToString());
                Assert.AreEqual(copyState.BytesCopied, copyProgress.BytesCopied);
                Assert.AreEqual(copyState.TotalBytes, copyProgress.BytesTotal);
                Assert.AreEqual(copyState.CompletionTime.Value.LocalDateTime, copyCompletionTime.Value);
                Assert.AreEqual(copyState.StatusDescription, copyStatusDescription);
                Assert.AreEqual(copyState.CopyId, copyId);
                Assert.AreEqual(copyState.Source, copySource);
            }
        }