本文整理汇总了C#中BlobServiceClient.GetBlobPropertiesAsync方法的典型用法代码示例。如果您正苦于以下问题:C# BlobServiceClient.GetBlobPropertiesAsync方法的具体用法?C# BlobServiceClient.GetBlobPropertiesAsync怎么用?C# BlobServiceClient.GetBlobPropertiesAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlobServiceClient
的用法示例。
在下文中一共展示了BlobServiceClient.GetBlobPropertiesAsync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBlobPropertiesAsync_ExistingBlob_GetsCorrectContentLength
public async void GetBlobPropertiesAsync_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 = await client.GetBlobPropertiesAsync(containerName, blobName);
Assert.AreEqual(expectedContentLength, properties.ContentLength);
}
示例2: GetBlobPropertiesAsync_ExistingBlob_GetsCorrectContentType
public async void GetBlobPropertiesAsync_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 = await client.GetBlobPropertiesAsync(containerName, blobName);
Assert.AreEqual(expectedContentType, properties.ContentType);
}
示例3: GetBlobPropertiesAsync_LeasedBlobLeaseBroken_GetsLeaseStateBroken
public async void GetBlobPropertiesAsync_LeasedBlobLeaseBroken_GetsLeaseStateBroken()
{
var containerName = _util.GenerateSampleContainerName(_runId);
var blobName = _util.GenerateSampleBlobName(_runId);
_util.CreateContainer(containerName);
_util.CreateBlockBlob(containerName, blobName);
var lease = _util.LeaseBlob(containerName, blobName, TimeSpan.FromSeconds(15));
_util.BreakBlobLease(containerName, blobName, lease);
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
Thread.Sleep(TimeSpan.FromSeconds(2));
var properties = await client.GetBlobPropertiesAsync(containerName, blobName);
Assert.AreEqual(LeaseState.Broken, properties.LeaseState);
}
示例4: GetBlobPropertiesAsync_LeasedBlob_GetsLeaseStatusLocked
public async void GetBlobPropertiesAsync_LeasedBlob_GetsLeaseStatusLocked()
{
var containerName = _util.GenerateSampleContainerName(_runId);
var blobName = _util.GenerateSampleBlobName(_runId);
_util.CreateContainer(containerName);
_util.CreateBlockBlob(containerName, blobName);
var lease = _util.LeaseBlob(containerName, blobName);
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = await client.GetBlobPropertiesAsync(containerName, blobName);
Assert.AreEqual(LeaseStatus.Locked, properties.LeaseStatus);
}
示例5: GetBlobPropertiesAsync_ExistingBlobWithSpecifiedContentLanguage_GetsCorrectContentLanguage
public async void GetBlobPropertiesAsync_ExistingBlobWithSpecifiedContentLanguage_GetsCorrectContentLanguage()
{
const string expectedLanguage = "dour";
var containerName = _util.GenerateSampleContainerName(_runId);
var blobName = _util.GenerateSampleBlobName(_runId);
_util.CreateContainer(containerName);
_util.CreateBlockBlob(containerName, blobName, contentLanguage: expectedLanguage);
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = await client.GetBlobPropertiesAsync(containerName, blobName);
Assert.AreEqual(expectedLanguage, properties.ContentLanguage);
}
示例6: GetBlobPropertiesAsync_EmptyBlobName_ThrowsArgumentNullException
public async void GetBlobPropertiesAsync_EmptyBlobName_ThrowsArgumentNullException()
{
var containerName = GenerateSampleContainerName();
var blobName = string.Empty;
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = await client.GetBlobPropertiesAsync(containerName, blobName);
// exception thrown
}
示例7: GetBlobPropertiesAsync_ExistingBlobWithMetadata_GetsCorrectMetadata
public async void GetBlobPropertiesAsync_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 = await client.GetBlobPropertiesAsync(containerName, blobName);
Assert.AreEqual(metadata, properties.Metadata);
}
示例8: GetBlobPropertiesAsync_ExistingBlobWithSpecifiedContentMD5_GetsCorrectContentMD5
public async void GetBlobPropertiesAsync_ExistingBlobWithSpecifiedContentMD5_GetsCorrectContentMD5()
{
var containerName = _util.GenerateSampleContainerName(_runId);
var blobName = _util.GenerateSampleBlobName(_runId);
_util.CreateContainer(containerName);
var blobMD5 = _util.CreateBlockBlob(containerName, blobName)
.Properties.ContentMD5;
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = await client.GetBlobPropertiesAsync(containerName, blobName);
Assert.AreEqual(blobMD5, properties.ContentMD5);
}
示例9: GetBlobPropertiesAsync_LeasedBlobLeaseBreaking_GetsLeaseStateBreaking
public async void GetBlobPropertiesAsync_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 = await client.GetBlobPropertiesAsync(containerName, blobName);
Assert.AreEqual(LeaseState.Breaking, properties.LeaseState);
}
示例10: GetBlobPropertiesAsync_NullBlobName_ThrowsArgumentNullException
public async void GetBlobPropertiesAsync_NullBlobName_ThrowsArgumentNullException()
{
var containerName = _util.GenerateSampleContainerName(_runId);
string blobName = null;
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = await client.GetBlobPropertiesAsync(containerName, blobName);
// exception thrown
}
示例11: GetBlobPropertiesAsync_UnleasedBlob_GetsLeaseStateAvailable
public async void GetBlobPropertiesAsync_UnleasedBlob_GetsLeaseStateAvailable()
{
var containerName = GenerateSampleContainerName();
var blobName = GenerateSampleBlobName();
CreateContainer(containerName);
CreateBlockBlob(containerName, blobName);
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = await client.GetBlobPropertiesAsync(containerName, blobName);
Assert.AreEqual(LeaseState.Available, properties.LeaseState);
}
示例12: GetBlobPropertiesAsync_ExistingBlockBlob_GetsBlockBlobType
public async void GetBlobPropertiesAsync_ExistingBlockBlob_GetsBlockBlobType()
{
var containerName = GenerateSampleContainerName();
var blobName = GenerateSampleBlobName();
CreateContainer(containerName);
CreateBlockBlob(containerName, blobName);
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = await client.GetBlobPropertiesAsync(containerName, blobName);
Assert.AreEqual(Communications.BlobService.BlobType.Block, properties.BlobType);
}
示例13: GetBlobPropertiesAsync_ExistingBlobJustModified_GetsCorrectLastModified
public async void GetBlobPropertiesAsync_ExistingBlobJustModified_GetsCorrectLastModified()
{
var containerName = GenerateSampleContainerName();
var blobName = GenerateSampleBlobName();
var createdAt = DateTime.Now;
CreateContainer(containerName);
CreateBlockBlob(containerName, blobName);
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var properties = await client.GetBlobPropertiesAsync(containerName, blobName);
AssertDatesEqualWithTolerance(createdAt, properties.LastModified);
}
示例14: GetBlobPropertiesAsync_ExistingBlob_HasAnETag
public async void GetBlobPropertiesAsync_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 = await client.GetBlobPropertiesAsync(containerName, blobName);
Assert.IsNotNullOrEmpty(properties.ETag);
}
示例15: GetBlobPropertiesAsync_ExistingPageBlob_GetsPageBlobType
public async void GetBlobPropertiesAsync_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 = await client.GetBlobPropertiesAsync(containerName, blobName);
Assert.AreEqual(Communications.Common.BlobType.Page, properties.BlobType);
}