< Summary

Class:Azure.Storage.Blobs.ChangeFeed.Chunk
Assembly:Azure.Storage.Blobs.ChangeFeed
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Blobs.ChangeFeed\src\Chunk.cs
Covered lines:21
Uncovered lines:1
Coverable lines:22
Total lines:74
Line coverage:95.4% (21 of 22)
Covered branches:1
Total branches:2
Branch coverage:50% (1 of 2)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_BlockOffset()-100%100%
get_EventIndex()-100%100%
get_ChunkPath()-100%100%
.ctor(...)-100%100%
HasNext()-100%100%
Next()-85.71%50%
.ctor()-100%100%

File(s)

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Collections.Generic;
 5using System.Threading;
 6using System.Threading.Tasks;
 7using Azure.Storage.Internal.Avro;
 8
 9namespace Azure.Storage.Blobs.ChangeFeed
 10{
 11    /// <summary>
 12    /// Chunk.
 13    /// </summary>
 14    internal class Chunk
 15    {
 16        /// <summary>
 17        /// Avro Reader to parser the Events.
 18        /// </summary>
 19        private readonly AvroReader _avroReader;
 20
 21        /// <summary>
 22        /// The byte offset of the beginning of the current
 23        /// Block.
 24        /// </summary>
 3020425        public virtual long BlockOffset { get; private set; }
 26
 27        /// <summary>
 28        /// The index of the Event within the current block.
 29        /// </summary>
 3020430        public virtual long EventIndex { get; private set; }
 31
 32        /// <summary>
 33        /// The path of the chunk.
 34        /// </summary>
 62035        public virtual string ChunkPath { get; private set; }
 36
 22837        public Chunk(
 22838            AvroReader avroReader,
 22839            long blockOffset,
 22840            long eventIndex,
 22841            string chunkPath)
 42        {
 22843            _avroReader = avroReader;
 22844            BlockOffset = blockOffset;
 22845            EventIndex = eventIndex;
 22846            ChunkPath = chunkPath;
 22847        }
 48
 49        public virtual bool HasNext()
 11854850            => _avroReader.HasNext();
 51
 52        public virtual async Task<BlobChangeFeedEvent> Next(
 53            bool async,
 54            CancellationToken cancellationToken = default)
 55        {
 56            Dictionary<string, object> result;
 57
 2958458            if (!HasNext())
 59            {
 060                return null;
 61            }
 62
 2958463            result = (Dictionary<string, object>)await _avroReader.Next(async, cancellationToken).ConfigureAwait(false);
 2958464            BlockOffset = _avroReader.BlockOffset;
 2958465            EventIndex = _avroReader.ObjectIndex;
 2958466            return new BlobChangeFeedEvent(result);
 2958467        }
 68
 69        /// <summary>
 70        /// Constructor for mocking.  Do not use.
 71        /// </summary>
 6472        internal Chunk() { }
 73    }
 74}