本文整理汇总了C#中BlobServiceClient.GetContainerProperties方法的典型用法代码示例。如果您正苦于以下问题:C# BlobServiceClient.GetContainerProperties方法的具体用法?C# BlobServiceClient.GetContainerProperties怎么用?C# BlobServiceClient.GetContainerProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlobServiceClient
的用法示例。
在下文中一共展示了BlobServiceClient.GetContainerProperties方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetContainerProperties_BreakingLeaseContainer_ReturnsLeaseDetails
public void GetContainerProperties_BreakingLeaseContainer_ReturnsLeaseDetails()
{
const int leaseLength = 30;
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var containerName = GenerateSampleContainerName();
CreateContainer(containerName);
string lease = LeaseContainer(containerName, TimeSpan.FromSeconds(leaseLength), null);
BreakContainerLease(containerName, lease, leaseLength);
try
{
var response = client.GetContainerProperties(containerName);
Assert.AreEqual(LeaseStatus.Locked, response.LeaseStatus);
Assert.AreEqual(LeaseState.Breaking, response.LeaseState);
}
finally
{
ReleaseContainerLease(containerName, lease);
}
}
示例2: GetContainerProperties_InfiniteLeaseContainer_ReturnsLeaseDetails
public void GetContainerProperties_InfiniteLeaseContainer_ReturnsLeaseDetails()
{
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var containerName = GenerateSampleContainerName();
CreateContainer(containerName);
string lease = LeaseContainer(containerName, null, null);
try
{
var response = client.GetContainerProperties(containerName);
Assert.AreEqual(LeaseStatus.Locked, response.LeaseStatus);
Assert.AreEqual(LeaseDuration.Infinite, response.LeaseDuration);
Assert.AreEqual(LeaseState.Leased, response.LeaseState);
}
finally
{
ReleaseContainerLease(containerName, lease);
}
}
示例3: GetContainerProperties_FixedLeaseContainer_ReturnsLeaseDetails
public void GetContainerProperties_FixedLeaseContainer_ReturnsLeaseDetails()
{
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var containerName = GenerateSampleContainerName();
CreateContainer(containerName);
LeaseContainer(containerName, TimeSpan.FromSeconds(30), null);
var response = client.GetContainerProperties(containerName);
Assert.AreEqual(LeaseStatus.Locked, response.LeaseStatus);
Assert.AreEqual(LeaseDuration.Fixed, response.LeaseDuration);
Assert.AreEqual(LeaseState.Leased, response.LeaseState);
}
示例4: GetContainerProperties_ContainerWithMetadata_ReturnsMetadata
public void GetContainerProperties_ContainerWithMetadata_ReturnsMetadata()
{
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var containerName = GenerateSampleContainerName();
CreateContainer(containerName, new Dictionary<string, string>() {
{ "a", "1" },
{ "b", "2" }
});
var response = client.GetContainerProperties(containerName);
Assert.IsNotNull(response.Metadata);
Assert.AreEqual(2, response.Metadata.Count);
Assert.IsTrue(response.Metadata.Any(kvp => kvp.Key == "a" && kvp.Value == "1"));
Assert.IsTrue(response.Metadata.Any(kvp => kvp.Key == "b" && kvp.Value == "2"));
}
示例5: GetContainerProperties_NonexistentContainer_ThrowsContainerNotFoundException
public void GetContainerProperties_NonexistentContainer_ThrowsContainerNotFoundException()
{
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var containerName = GenerateSampleContainerName();
client.GetContainerProperties(containerName);
// expects exception
}
示例6: GetContainerProperties_ValidContainer_ReturnsProperties
public void GetContainerProperties_ValidContainer_ReturnsProperties()
{
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var containerName = GenerateSampleContainerName();
CreateContainer(containerName);
var response = client.GetContainerProperties(containerName);
Assert.IsNotNull(response.Metadata);
Assert.IsNotNullOrEmpty(response.ETag);
Assert.AreEqual(LeaseStatus.Unlocked, response.LeaseStatus);
Assert.AreEqual(LeaseState.Available, response.LeaseState);
}