当前位置: 首页>>代码示例>>C#>>正文


C# BlobServiceClient.ListBlobs方法代码示例

本文整理汇总了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);
        }
开发者ID:renlesterdg,项目名称:BasicAzureStorageSDK,代码行数:11,代码来源:BlobServiceClientTests.cs

示例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));
        }
开发者ID:renlesterdg,项目名称:BasicAzureStorageSDK,代码行数:14,代码来源:BlobServiceClientTests.cs

示例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);
        }
开发者ID:renlesterdg,项目名称:BasicAzureStorageSDK,代码行数:17,代码来源:BlobServiceClientTests.cs

示例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));
        }
开发者ID:renlesterdg,项目名称:BasicAzureStorageSDK,代码行数:14,代码来源:BlobServiceClientTests.cs

示例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);
        }
开发者ID:renlesterdg,项目名称:BasicAzureStorageSDK,代码行数:16,代码来源:BlobServiceClientTests.cs

示例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"));
        }
开发者ID:renlesterdg,项目名称:BasicAzureStorageSDK,代码行数:18,代码来源:BlobServiceClientTests.cs

示例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);
        }
开发者ID:renlesterdg,项目名称:BasicAzureStorageSDK,代码行数:15,代码来源:BlobServiceClientTests.cs

示例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"));
        }
开发者ID:renlesterdg,项目名称:BasicAzureStorageSDK,代码行数:17,代码来源:BlobServiceClientTests.cs

示例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"));
        }
开发者ID:renlesterdg,项目名称:BasicAzureStorageSDK,代码行数:15,代码来源:BlobServiceClientTests.cs

示例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"));
        }
开发者ID:renlesterdg,项目名称:BasicAzureStorageSDK,代码行数:14,代码来源:BlobServiceClientTests.cs

示例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);
        }
开发者ID:renlesterdg,项目名称:BasicAzureStorageSDK,代码行数:10,代码来源:BlobServiceClientTests.cs


注:本文中的BlobServiceClient.ListBlobs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。