< Summary

Class:Azure.Storage.Blobs.Models.GetBlobContainersAsyncCollection
Assembly:Azure.Storage.Blobs
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Blobs\src\Models\GetBlobContainersAsyncCollection.cs
Covered lines:23
Uncovered lines:0
Coverable lines:23
Total lines:88
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\GetBlobContainersAsyncCollection.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.Diagnostics;
 8using System.Linq;
 9using System.Threading;
 10using System.Threading.Tasks;
 11using Azure.Core.Pipeline;
 12using Azure.Storage.Blobs.Models;
 13
 14namespace Azure.Storage.Blobs.Models
 15{
 16    internal class GetBlobContainersAsyncCollection : StorageCollectionEnumerator<BlobContainerItem>
 17    {
 18        private readonly BlobServiceClient _client;
 19        private readonly BlobContainerTraits _traits;
 20        private readonly BlobContainerStates _states;
 21        private readonly string _prefix;
 22
 6823        public GetBlobContainersAsyncCollection(
 6824            BlobServiceClient client,
 6825            BlobContainerTraits traits,
 6826            BlobContainerStates states,
 6827            string prefix = default)
 28        {
 6829            _client = client;
 6830            _traits = traits;
 6831            _states = states;
 6832            _prefix = prefix;
 6833        }
 34
 35        public override async ValueTask<Page<BlobContainerItem>> GetNextPageAsync(
 36            string continuationToken,
 37            int? pageSizeHint,
 38            bool async,
 39            CancellationToken cancellationToken)
 40        {
 41
 6842            Response<BlobContainersSegment> response = await _client.GetBlobContainersInternal(
 6843                    continuationToken,
 6844                    _traits,
 6845                    _states,
 6846                    _prefix,
 6847                    pageSizeHint,
 6848                    async,
 6849                    cancellationToken).ConfigureAwait(false);
 50
 6451            return Page<BlobContainerItem>.FromValues(
 6452                response.Value.BlobContainerItems.ToArray(),
 6453                response.Value.NextMarker,
 6454                response.GetRawResponse());
 6455        }
 56    }
 57}
 58
 59namespace Azure.Storage.Blobs
 60{
 61    /// <summary>
 62    /// BlobContainerTraits/BlobContianerStates enum methods.
 63    /// </summary>
 64    internal static partial class BlobExtensions
 65    {
 66        /// <summary>
 67        /// Convert the details into ListContainersIncludeType values.
 68        /// </summary>
 69        /// <returns>ListContainersIncludeType values</returns>
 70        internal static IEnumerable<ListContainersIncludeType> AsIncludeItems(BlobContainerTraits traits, BlobContainerS
 71        {
 72            // Remove this line
 73            Debug.Assert(states == BlobContainerStates.None);
 74            var items = new List<ListContainersIncludeType>();
 75            // Uncomment when feature is re-enabled.
 76            //if ((states & BlobContainerStates.Deleted) == BlobContainerStates.Deleted)
 77            //{
 78            //    items.Add(ListContainersIncludeType.Deleted);
 79            //}
 80            if ((traits & BlobContainerTraits.Metadata) == BlobContainerTraits.Metadata)
 81            {
 82                items.Add(ListContainersIncludeType.Metadata);
 83            }
 84
 85            return items.Count > 0 ? items : null;
 86        }
 87    }
 88}

Methods/Properties

.ctor(...)
GetNextPageAsync()