< Summary

Class:Azure.Storage.Blobs.Models.GetBlobsAsyncCollection
Assembly:Azure.Storage.Blobs
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Blobs\src\Models\GetBlobsAsyncCollection.cs
Covered lines:23
Uncovered lines:0
Coverable lines:23
Total lines:104
Line coverage:100% (23 of 23)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
GetNextPageAsync()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Blobs\src\Models\GetBlobsAsyncCollection.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4#pragma warning disable SA1402  // File may only contain a single type
 5
 6using System.Collections.Generic;
 7using System.Linq;
 8using System.Threading;
 9using System.Threading.Tasks;
 10using Azure.Core.Pipeline;
 11using Azure.Storage.Blobs.Models;
 12
 13namespace Azure.Storage.Blobs.Models
 14{
 15    internal class GetBlobsAsyncCollection : StorageCollectionEnumerator<BlobItem>
 16    {
 17        private readonly BlobContainerClient _client;
 18        private readonly BlobTraits _traits;
 19        private readonly BlobStates _states;
 20        private readonly string _prefix;
 21
 14622        public GetBlobsAsyncCollection(
 14623            BlobContainerClient client,
 14624            BlobTraits traits,
 14625            BlobStates states,
 14626            string prefix)
 27        {
 14628            _client = client;
 14629            _traits = traits;
 14630            _states = states;
 14631            _prefix = prefix;
 14632        }
 33
 34        public override async ValueTask<Page<BlobItem>> GetNextPageAsync(
 35            string continuationToken,
 36            int? pageSizeHint,
 37            bool async,
 38            CancellationToken cancellationToken)
 39        {
 14640            Response<BlobsFlatSegment> response = await _client.GetBlobsInternal(
 14641                continuationToken,
 14642                _traits,
 14643                _states,
 14644                _prefix,
 14645                pageSizeHint,
 14646                async,
 14647                cancellationToken).ConfigureAwait(false);
 48
 14249            return Page<BlobItem>.FromValues(
 14250                response.Value.BlobItems.ToBlobItems().ToArray(),
 14251                response.Value.NextMarker,
 14252                response.GetRawResponse());
 14253        }
 54    }
 55}
 56
 57namespace Azure.Storage.Blobs
 58{
 59    /// <summary>
 60    /// BlobTraits/BlobStates enum methods
 61    /// </summary>
 62    internal static partial class BlobExtensions
 63    {
 64        /// <summary>
 65        /// Convert the details into ListBlobsIncludeItem values.
 66        /// </summary>
 67        /// <returns>ListBlobsIncludeItem values</returns>
 68        internal static IEnumerable<ListBlobsIncludeItem> AsIncludeItems(BlobTraits traits, BlobStates states)
 69        {
 70            // NOTE: Multiple strings MUST be appended in alphabetic order or signing the string for authentication fail
 71            // TODO: Remove this requirement by pushing it closer to header generation.
 72            var items = new List<ListBlobsIncludeItem>();
 73            if ((traits & BlobTraits.CopyStatus) == BlobTraits.CopyStatus)
 74            {
 75                items.Add(ListBlobsIncludeItem.Copy);
 76            }
 77            if ((states & BlobStates.Deleted) == BlobStates.Deleted)
 78            {
 79                items.Add(ListBlobsIncludeItem.Deleted);
 80            }
 81            if ((traits & BlobTraits.Metadata) == BlobTraits.Metadata)
 82            {
 83                items.Add(ListBlobsIncludeItem.Metadata);
 84            }
 85            if ((states & BlobStates.Snapshots) == BlobStates.Snapshots)
 86            {
 87                items.Add(ListBlobsIncludeItem.Snapshots);
 88            }
 89            if ((traits & BlobTraits.Tags) == BlobTraits.Tags)
 90            {
 91                items.Add(ListBlobsIncludeItem.Tags);
 92            }
 93            if ((states & BlobStates.Uncommitted) == BlobStates.Uncommitted)
 94            {
 95                items.Add(ListBlobsIncludeItem.Uncommittedblobs);
 96            }
 97            if ((states & BlobStates.Version) == BlobStates.Version)
 98            {
 99                items.Add(ListBlobsIncludeItem.Versions);
 100            }
 101            return items.Count > 0 ? items : null;
 102        }
 103    }
 104}

Methods/Properties

.ctor(...)
GetNextPageAsync()