本文整理汇总了C#中BlobServiceClient.GetBlobProperties方法的典型用法代码示例。如果您正苦于以下问题:C# BlobServiceClient.GetBlobProperties方法的具体用法?C# BlobServiceClient.GetBlobProperties怎么用?C# BlobServiceClient.GetBlobProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlobServiceClient
的用法示例。
在下文中一共展示了BlobServiceClient.GetBlobProperties方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBlobProperties_ExistingBlob_HasAnETag
public void GetBlobProperties_ExistingBlob_HasAnETag()
{
var containerName = _util.GenerateSampleContainerName(_runId);
var blobName = _util.GenerateSampleBlobName(_runId);
_util.CreateContainer(containerName);
_util.CreateBlockBlob(containerName, blobName);
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = client.GetBlobProperties(containerName, blobName);
Assert.IsNotNullOrEmpty(properties.ETag);
}
示例2: GetBlobProperties_ExistingBlob_GetsCorrectContentLength
public void GetBlobProperties_ExistingBlob_GetsCorrectContentLength()
{
const string blobContents = "foo";
var expectedContentLength = Encoding.UTF8.GetByteCount(blobContents);
var containerName = _util.GenerateSampleContainerName(_runId);
var blobName = _util.GenerateSampleBlobName(_runId);
_util.CreateContainer(containerName);
_util.CreateBlockBlob(containerName, blobName, content: blobContents);
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = client.GetBlobProperties(containerName, blobName);
Assert.AreEqual(expectedContentLength, properties.ContentLength);
}
示例3: GetBlobProperties_ExistingBlob_GetsCorrectContentType
public void GetBlobProperties_ExistingBlob_GetsCorrectContentType()
{
const string expectedContentType = "pigeon/feathers";
var containerName = _util.GenerateSampleContainerName(_runId);
var blobName = _util.GenerateSampleBlobName(_runId);
_util.CreateContainer(containerName);
_util.CreateBlockBlob(containerName, blobName, contentType: expectedContentType);
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = client.GetBlobProperties(containerName, blobName);
Assert.AreEqual(expectedContentType, properties.ContentType);
}
示例4: GetBlobProperties_EmptyBlobName_ThrowsArgumentNullException
public void GetBlobProperties_EmptyBlobName_ThrowsArgumentNullException()
{
var containerName = GenerateSampleContainerName();
var blobName = string.Empty;
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = client.GetBlobProperties(containerName, blobName);
// exception thrown
}
示例5: GetBlobProperties_UnleasedBlob_GetsLeaseStatusUnlocked
public void GetBlobProperties_UnleasedBlob_GetsLeaseStatusUnlocked()
{
var containerName = _util.GenerateSampleContainerName(_runId);
var blobName = _util.GenerateSampleBlobName(_runId);
_util.CreateContainer(containerName);
_util.CreateBlockBlob(containerName, blobName);
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = client.GetBlobProperties(containerName, blobName);
Assert.AreEqual(LeaseStatus.Unlocked, properties.LeaseStatus);
}
示例6: GetBlobProperties_ExistingBlobWithSpecifiedContentEncoding_GetsCorrectContentEncoding
public void GetBlobProperties_ExistingBlobWithSpecifiedContentEncoding_GetsCorrectContentEncoding()
{
const string expectedEncoding = "with minimal distraction";
var containerName = _util.GenerateSampleContainerName(_runId);
var blobName = _util.GenerateSampleBlobName(_runId);
_util.CreateContainer(containerName);
_util.CreateBlockBlob(containerName, blobName, contentEncoding: expectedEncoding);
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = client.GetBlobProperties(containerName, blobName);
Assert.AreEqual(expectedEncoding, properties.ContentEncoding);
}
示例7: GetBlobProperties_ExistingBlob_GetsCorrectDate
public void GetBlobProperties_ExistingBlob_GetsCorrectDate()
{
var containerName = _util.GenerateSampleContainerName(_runId);
var blobName = _util.GenerateSampleBlobName(_runId);
_util.CreateContainer(containerName);
var createdDate = DateTime.Now;
_util.CreateBlockBlob(containerName, blobName);
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = client.GetBlobProperties(containerName, blobName);
_util.AssertDatesEqualWithTolerance(createdDate, properties.Date);
}
示例8: GetBlobProperties_ExistingBlobWithMetadata_GetsCorrectMetadata
public void GetBlobProperties_ExistingBlobWithMetadata_GetsCorrectMetadata()
{
var metadata = new Dictionary<string, string>{
{ "HeyHey", "We're the" },
{ "GroundControl", "CallingMajor" }
};
var containerName = _util.GenerateSampleContainerName(_runId);
var blobName = _util.GenerateSampleBlobName(_runId);
_util.CreateContainer(containerName);
_util.CreateBlockBlob(containerName, blobName, metadata);
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = client.GetBlobProperties(containerName, blobName);
Assert.AreEqual(metadata, properties.Metadata);
}
示例9: GetBlobProperties_ExistingPageBlob_GetsPageBlobType
public void GetBlobProperties_ExistingPageBlob_GetsPageBlobType()
{
var containerName = _util.GenerateSampleContainerName(_runId);
var blobName = _util.GenerateSampleBlobName(_runId);
_util.CreateContainer(containerName);
_util.CreatePageBlob(containerName, blobName);
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = client.GetBlobProperties(containerName, blobName);
Assert.AreEqual(Communications.Common.BlobType.Page, properties.BlobType);
}
示例10: GetBlobProperties_LeasedBlobLeaseBreaking_GetsLeaseStateBreaking
public void GetBlobProperties_LeasedBlobLeaseBreaking_GetsLeaseStateBreaking()
{
var containerName = GenerateSampleContainerName();
var blobName = GenerateSampleBlobName();
CreateContainer(containerName);
CreateBlockBlob(containerName, blobName);
var lease = LeaseBlob(containerName, blobName, TimeSpan.FromSeconds(60));
BreakBlobLease(containerName, blobName, lease, 30);
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
Thread.Sleep(TimeSpan.FromSeconds(16));
var properties = client.GetBlobProperties(containerName, blobName);
Assert.AreEqual(LeaseState.Breaking, properties.LeaseState);
}
示例11: GetBlobProperties_NullBlobName_ThrowsArgumentNullException
public void GetBlobProperties_NullBlobName_ThrowsArgumentNullException()
{
var containerName = _util.GenerateSampleContainerName(_runId);
string blobName = null;
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = client.GetBlobProperties(containerName, blobName);
// exception thrown
}
示例12: GetBlobProperties_LeasedBlob_GetsLeaseStateLeased
public void GetBlobProperties_LeasedBlob_GetsLeaseStateLeased()
{
var containerName = GenerateSampleContainerName();
var blobName = GenerateSampleBlobName();
CreateContainer(containerName);
CreateBlockBlob(containerName, blobName);
LeaseBlob(containerName, blobName);
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = client.GetBlobProperties(containerName, blobName);
Assert.AreEqual(LeaseState.Leased, properties.LeaseState);
}
示例13: GetBlobProperties_ExistingBlockBlob_GetsBlockBlobType
public void GetBlobProperties_ExistingBlockBlob_GetsBlockBlobType()
{
var containerName = GenerateSampleContainerName();
var blobName = GenerateSampleBlobName();
CreateContainer(containerName);
CreateBlockBlob(containerName, blobName);
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = client.GetBlobProperties(containerName, blobName);
Assert.AreEqual(Communications.BlobService.BlobType.Block, properties.BlobType);
}
示例14: GetBlobProperties_ExistingBlobJustModified_GetsCorrectLastModified
public void GetBlobProperties_ExistingBlobJustModified_GetsCorrectLastModified()
{
var containerName = GenerateSampleContainerName();
var blobName = GenerateSampleBlobName();
var createdAt = DateTime.Now;
CreateContainer(containerName);
CreateBlockBlob(containerName, blobName);
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = client.GetBlobProperties(containerName, blobName);
AssertDatesEqualWithTolerance(createdAt, properties.LastModified);
}
示例15: GetBlobProperties_ExistingBlobModified_ETagPropertyChanges
public void GetBlobProperties_ExistingBlobModified_ETagPropertyChanges()
{
var containerName = _util.GenerateSampleContainerName(_runId);
var blobName = _util.GenerateSampleBlobName(_runId);
_util.CreateContainer(containerName);
_util.CreateBlockBlob(containerName, blobName);
var initialProperties = _util.GetBlobProperties(containerName, blobName);
_util.UpdateBlockBlob(containerName, blobName);
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var postChangeProperties = client.GetBlobProperties(containerName, blobName);
Assert.AreNotEqual(initialProperties.ETag, postChangeProperties.ETag);
}