< Summary

Class:Azure.Storage.Files.Shares.Models.ShareFileRangeInfo
Assembly:Azure.Storage.Files.Shares
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Files.Shares\src\Models\ShareFileRangeInfo.cs
Covered lines:8
Uncovered lines:3
Coverable lines:11
Total lines:86
Line coverage:72.7% (8 of 11)
Covered branches:1
Total branches:2
Branch coverage:50% (1 of 2)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_LastModified()-100%100%
get_ETag()-100%100%
get_FileContentLength()-100%100%
get_Ranges()-0%100%
.ctor(...)-71.43%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Files.Shares\src\Models\ShareFileRangeInfo.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;
 7
 8namespace Azure.Storage.Files.Shares.Models
 9{
 10    /// <summary>
 11    /// Contains file share range information returned from the ShareFileClient.GetRangeList operations.
 12    /// </summary>
 13    public class ShareFileRangeInfo
 14    {
 15        /// <summary>
 16        /// Model type expected by the protocol layer.
 17        /// </summary>
 18        private readonly ShareFileRangeInfoInternal _shareFileRangeInfoInternal;
 19
 20        /// <summary>
 21        /// The date/time that the file was last modified. Any operation that modifies the file, including an update of 
 22        /// </summary>
 223        public System.DateTimeOffset LastModified => _shareFileRangeInfoInternal.LastModified;
 24
 25        /// <summary>
 26        /// The ETag contains a value which represents the version of the file, in quotes.
 27        /// </summary>
 628        public ETag ETag => _shareFileRangeInfoInternal.ETag;
 29
 30        /// <summary>
 31        /// The size of the file in bytes.
 32        /// </summary>
 233        public long FileContentLength => _shareFileRangeInfoInternal.FileContentLength;
 34
 35        /// <summary>
 36        /// A list of non-overlapping valid ranges, sorted by increasing address range.
 37        /// </summary>
 038        public IEnumerable<HttpRange> Ranges { get; internal set; }
 39
 40        /// <summary>
 41        /// Creates a new PageRangesInfo instance
 42        /// </summary>
 643        internal ShareFileRangeInfo(ShareFileRangeInfoInternal rangesInfoInternal)
 44        {
 645            _shareFileRangeInfoInternal = rangesInfoInternal;
 46
 47            // convert from internal Range type to HttpRange
 648            var ranges = new List<HttpRange>();
 049            foreach (Range range in rangesInfoInternal.Ranges)
 50            {
 051                ranges.Add(new HttpRange(range.Start, range.End - range.Start + 1));
 52            }
 653            Ranges = ranges;
 654        }
 55    }
 56
 57    /// <summary>
 58    /// ShareModelFactory provides utilities for mocking.
 59    /// </summary>
 60    public static partial class ShareModelFactory
 61    {
 62        /// <summary>
 63        /// Creates a new ShareFileRangeInfo instance for mocking.
 64        /// </summary>
 65        public static ShareFileRangeInfo ShareFileRangeInfo(
 66            System.DateTimeOffset lastModified,
 67            Azure.ETag eTag,
 68            long fileContentLength,
 69            IEnumerable<HttpRange> ranges)
 70        {
 71            var shareFileRangeInfo =
 72                new ShareFileRangeInfo(
 73                    new ShareFileRangeInfoInternal()
 74                    {
 75                        LastModified = lastModified,
 76                        ETag = eTag,
 77                        FileContentLength = fileContentLength
 78                    }
 79                )
 80                {
 81                    Ranges = ranges
 82                };
 83            return shareFileRangeInfo;
 84        }
 85    }
 86}