本文整理匯總了C#中BlobServiceClient.ListBlobs方法的典型用法代碼示例。如果您正苦於以下問題:C# BlobServiceClient.ListBlobs方法的具體用法?C# BlobServiceClient.ListBlobs怎麽用?C# BlobServiceClient.ListBlobs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BlobServiceClient
的用法示例。
在下文中一共展示了BlobServiceClient.ListBlobs方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ListBlobs_IncludeUncommittedBlobs_ReturnsUncommittedBlobs
public void ListBlobs_IncludeUncommittedBlobs_ReturnsUncommittedBlobs()
{
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var containerName = GenerateSampleContainerName();
CreateContainer(containerName);
CreateBlobUncommitted(containerName, "blob1");
var result = client.ListBlobs(containerName, include: ListBlobsInclude.UncomittedBlobs);
Assert.AreEqual(1, result.BlobList.Count);
}
示例2: ListBlobs_BlockAndPageBlobs_ReturnsBothTypes
public void ListBlobs_BlockAndPageBlobs_ReturnsBothTypes()
{
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var containerName = GenerateSampleContainerName();
CreateContainer(containerName);
CreateBlockBlob(containerName, "blob1");
CreatePageBlob(containerName, "blob2");
var result = client.ListBlobs(containerName);
Assert.AreEqual(2, result.BlobList.Count);
Assert.IsTrue(result.BlobList.Any(b => b.Properties.BlobType == Communications.Common.BlobType.Block));
Assert.IsTrue(result.BlobList.Any(b => b.Properties.BlobType == Communications.Common.BlobType.Page));
}
示例3: ListBlobs_IncludeCopy_ReturnsCopyStatus
public void ListBlobs_IncludeCopy_ReturnsCopyStatus()
{
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var containerName = GenerateSampleContainerName();
CreateContainer(containerName);
CreateBlockBlob(containerName, "blob1");
CopyBlob(containerName, "blob1", "blob1copy");
var result = client.ListBlobs(containerName, include: ListBlobsInclude.Copy);
var copiedBlob = result.BlobList.Where(b => b.Name == "blob1copy").FirstOrDefault();
Assert.IsNotNull(copiedBlob);
Assert.IsNotEmpty(copiedBlob.Properties.CopyId);
Assert.IsNotNull(copiedBlob.Properties.CopySource);
Assert.IsNotEmpty(copiedBlob.Properties.CopyProgress);
Assert.IsNotNull(copiedBlob.Properties.CopyStatus);
}
示例4: ListBlobs_IncludeSnapshots_ReturnsSnapshotDetails
public void ListBlobs_IncludeSnapshots_ReturnsSnapshotDetails()
{
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var containerName = GenerateSampleContainerName();
CreateContainer(containerName);
CreateBlockBlob(containerName, "blob1");
SnapshotBlob(containerName, "blob1");
var result = client.ListBlobs(containerName, include: ListBlobsInclude.Snapshots);
Assert.AreEqual(2, result.BlobList.Count);
Assert.IsTrue(result.BlobList.Any(b => b.Snapshot.HasValue));
Assert.IsTrue(result.BlobList.Any(b => !b.Snapshot.HasValue));
}
示例5: ListBlobs_MarkerSuppliedForLongerList_ReturnsNextSetofResults
public void ListBlobs_MarkerSuppliedForLongerList_ReturnsNextSetofResults()
{
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var containerName = GenerateSampleContainerName();
CreateContainer(containerName);
CreateBlockBlob(containerName, "blob1");
CreateBlockBlob(containerName, "blob2");
CreateBlockBlob(containerName, "blob3");
var result = client.ListBlobs(containerName, maxResults: 2);
var nextMarker = result.NextMarker;
var remainingResult = client.ListBlobs(containerName, marker: nextMarker);
Assert.AreEqual(1, remainingResult.BlobList.Count);
Assert.IsNotNullOrEmpty(remainingResult.Marker);
}
示例6: ListBlobs_IncludeMetadata_ReturnsMetadataInResults
public void ListBlobs_IncludeMetadata_ReturnsMetadataInResults()
{
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var containerName = GenerateSampleContainerName();
CreateContainer(containerName);
CreateBlockBlob(containerName, "blob1", new Dictionary<string, string>() {
{ "a", "1"},
{ "b", "2"}
});
var result = client.ListBlobs(containerName, include: ListBlobsInclude.Metadata);
Assert.AreEqual("blob1", result.BlobList[0].Name, "The list blob results did not include the test blob we setup with metadata as the first entry");
Assert.IsNotEmpty(result.BlobList[0].Metadata);
Assert.AreEqual(2, result.BlobList[0].Metadata.Count);
Assert.IsTrue(result.BlobList[0].Metadata.Any(kvp => kvp.Key == "a" && kvp.Value == "1"));
Assert.IsTrue(result.BlobList[0].Metadata.Any(kvp => kvp.Key == "b" && kvp.Value == "2"));
}
示例7: ListBlobs_SmallerMaxResultsThanBlobCount_ReturnsResultsAndContinuationMarker
public void ListBlobs_SmallerMaxResultsThanBlobCount_ReturnsResultsAndContinuationMarker()
{
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var containerName = GenerateSampleContainerName();
CreateContainer(containerName);
CreateBlockBlob(containerName, "blob1");
CreateBlockBlob(containerName, "blob2");
CreateBlockBlob(containerName, "blob3");
var result = client.ListBlobs(containerName, maxResults: 2);
Assert.AreEqual(2, result.BlobList.Count);
Assert.AreEqual(2, result.MaxResults);
Assert.IsNotNullOrEmpty(result.NextMarker);
}
示例8: ListBlobs_PrefixAndDelimiterSupplied_ReturnsOnlyBlobsMatchingThatPrefixWithNamesTruncatedAtDelimiter
public void ListBlobs_PrefixAndDelimiterSupplied_ReturnsOnlyBlobsMatchingThatPrefixWithNamesTruncatedAtDelimiter()
{
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var containerName = GenerateSampleContainerName();
CreateContainer(containerName);
CreateBlockBlob(containerName, "blob/UnitTest/SampleA");
CreateBlockBlob(containerName, "blob/UnitTest/SampleB");
CreateBlockBlob(containerName, "SomethingElse.txt");
string expectedPrefix = "blob/UnitTest/";
var result = client.ListBlobs(containerName, prefix: expectedPrefix, delimiter: "/");
Assert.AreEqual(2, result.BlobList.Count);
Assert.AreEqual(expectedPrefix, result.Prefix);
Assert.IsTrue(result.BlobList.Any(b => b.Name == "blob/UnitTest/SampleA"));
Assert.IsTrue(result.BlobList.Any(b => b.Name == "blob/UnitTest/SampleB"));
}
示例9: ListBlobs_PrefixSupplied_ReturnsOnlyBlobsMatchingThatPrefix
public void ListBlobs_PrefixSupplied_ReturnsOnlyBlobsMatchingThatPrefix()
{
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var containerName = GenerateSampleContainerName();
CreateContainer(containerName);
CreateBlockBlob(containerName, "blob/UnitTest/SampleA");
CreateBlockBlob(containerName, "blob/UnitTest/SampleB");
CreateBlockBlob(containerName, "SomethingElse.txt");
var result = client.ListBlobs(containerName, prefix: "blob");
Assert.AreEqual(2, result.BlobList.Count);
Assert.IsTrue(result.BlobList.Any(b => b.Name == "blob/UnitTest/SampleA"));
Assert.IsTrue(result.BlobList.Any(b => b.Name == "blob/UnitTest/SampleB"));
}
示例10: ListBlobs_PopulatedContainer_ReturnsExpectedBlobsInList
public void ListBlobs_PopulatedContainer_ReturnsExpectedBlobsInList()
{
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var containerName = GenerateSampleContainerName();
CreateContainer(containerName);
CreateBlockBlob(containerName, "blob/UnitTest/SampleA");
CreateBlockBlob(containerName, "blob/UnitTest/SampleB");
var result = client.ListBlobs(containerName);
Assert.AreEqual(2, result.BlobList.Count);
Assert.IsTrue(result.BlobList.Any(b => b.Name == "blob/UnitTest/SampleA"));
Assert.IsTrue(result.BlobList.Any(b => b.Name == "blob/UnitTest/SampleB"));
}
示例11: ListBlobs_EmptyContainer_ReturnsEmptyList
public void ListBlobs_EmptyContainer_ReturnsEmptyList()
{
IBlobServiceClient client = new BlobServiceClient(AccountSettings);
var containerName = GenerateSampleContainerName();
CreateContainer(containerName);
var result = client.ListBlobs(containerName);
Assert.IsEmpty(result.BlobList);
}