< Summary

Class:Azure.Storage.Files.Shares.Models.CloseHandlesResult
Assembly:Azure.Storage.Files.Shares
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Files.Shares\src\Models\CloseHandlesResult.cs
Covered lines:3
Uncovered lines:0
Coverable lines:3
Total lines:78
Line coverage:100% (3 of 3)
Covered branches:0
Total branches:0

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Files.Shares\src\Models\CloseHandlesResult.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 Azure.Storage.Files.Shares.Models;
 7
 8namespace Azure.Storage.Files.Shares.Models
 9{
 10    /// <summary>
 11    /// The result of a force close handle or force close all handles operation.
 12    /// </summary>
 13    public class CloseHandlesResult
 14    {
 15        /// <summary>
 16        /// The number of file handles that were closed.
 17        /// </summary>
 1218        public int ClosedHandlesCount { get; internal set; }
 19
 20        /// <summary>
 21        /// The number of file handles that fialed to close.
 22        /// </summary>
 1223        public int FailedHandlesCount { get; internal set; }
 24
 25        /// <summary>
 26        /// Prevent direct instantiation of ClosedHandlesInfo instances.
 27        /// You can use FileModelFactory.ClosedHandlesInfo instead.
 28        /// </summary>
 1229        internal CloseHandlesResult() { }
 30    }
 31
 32    /// <summary>
 33    /// FilesModelFactory provides utilities for mocking.
 34    /// </summary>
 35    public static partial class FileModelFactory
 36    {
 37        /// <summary>
 38        /// Creates a new ClosedHandlesInfo instance for mocking.
 39        /// </summary>
 40        public static CloseHandlesResult ClosedHandlesInfo(
 41            int closedHandlesCount)
 42            => ClosedHandlesInfo(
 43                closedHandlesCount: closedHandlesCount,
 44                failedHandlesCount: 0);
 45
 46        /// <summary>
 47        /// Creates a new ClosedHandlesInfo instance for mocking.
 48        /// </summary>
 49        public static CloseHandlesResult ClosedHandlesInfo(
 50            int closedHandlesCount,
 51            int failedHandlesCount)
 52            => new CloseHandlesResult()
 53            {
 54                ClosedHandlesCount = closedHandlesCount,
 55                FailedHandlesCount = failedHandlesCount
 56            };
 57    }
 58}
 59
 60namespace Azure.Storage.Files.Shares
 61{
 62    internal static partial class ShareExtensions
 63    {
 64        internal static CloseHandlesResult ToCloseHandlesResult(this Response<StorageClosedHandlesSegment> storageClosed
 65        {
 66            if (storageClosedHandlesSegment == null || storageClosedHandlesSegment.Value == null)
 67            {
 68                return null;
 69            }
 70
 71            return new CloseHandlesResult
 72            {
 73                ClosedHandlesCount = storageClosedHandlesSegment.Value.NumberOfHandlesClosed,
 74                FailedHandlesCount = storageClosedHandlesSegment.Value.NumberOfHandlesFailedToClose
 75            };
 76        }
 77    }
 78}