< Summary

Class:Azure.Storage.Files.Shares.Models.ShareFileProperties
Assembly:Azure.Storage.Files.Shares
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Files.Shares\src\Models\ShareFileProperties.cs
Covered lines:24
Uncovered lines:1
Coverable lines:25
Total lines:196
Line coverage:96% (24 of 25)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_LastModified()-100%100%
get_Metadata()-100%100%
get_ContentLength()-0%100%
get_ContentType()-100%100%
get_ETag()-100%100%
get_ContentHash()-100%100%
get_ContentEncoding()-100%100%
get_CacheControl()-100%100%
get_ContentDisposition()-100%100%
get_ContentLanguage()-100%100%
get_CopyCompletedOn()-100%100%
get_CopyStatusDescription()-100%100%
get_CopyId()-100%100%
get_CopyProgress()-100%100%
get_CopySource()-100%100%
get_CopyStatus()-100%100%
get_IsServerEncrypted()-100%100%
get_SmbProperties()-100%100%
get_LeaseDuration()-100%100%
get_LeaseState()-100%100%
get_LeaseStatus()-100%100%
.ctor(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Files.Shares\src\Models\ShareFileProperties.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Collections.Generic;
 6
 7#pragma warning disable SA1402  // File may only contain a single type
 8
 9namespace Azure.Storage.Files.Shares.Models
 10{
 11    /// <summary>
 12    /// Properties for a file.
 13    /// </summary>
 14    public class ShareFileProperties
 15    {
 16        /// <summary>
 17        /// The internal RawStorageFileProperties
 18        /// </summary>
 19        internal RawStorageFileProperties _rawStorageFileProperties;
 20
 21        /// <summary>
 22        /// The DateTimeOffset when the file was last modified.
 23        /// </summary>
 424        public DateTimeOffset LastModified => _rawStorageFileProperties.LastModified;
 25
 26        /// <summary>
 27        /// A set of name-value pairs associated with this file as user-defined metadata.
 28        /// </summary>
 1029        public IDictionary<string, string> Metadata => _rawStorageFileProperties.Metadata;
 30
 31        /// <summary>
 32        /// The size of the file in bytes.
 33        /// </summary>
 034        public long ContentLength => _rawStorageFileProperties.ContentLength;
 35
 36        /// <summary>
 37        /// The content type specified for the file. The default content type is 'application/octet-stream'
 38        /// </summary>
 839        public string ContentType => _rawStorageFileProperties.ContentType;
 40
 41        /// <summary>
 42        /// The ETag contains a value that you can use to perform operations conditionally, in quotes.
 43        /// </summary>
 2644        public ETag ETag => _rawStorageFileProperties.ETag;
 45
 46        /// <summary>
 47        /// If the Content-MD5 header has been set for the file, the Content-MD5 response header is returned so that the
 48        /// </summary>
 49#pragma warning disable CA1819 // Properties should not return arrays
 450        public byte[] ContentHash => _rawStorageFileProperties.ContentHash;
 51#pragma warning restore CA1819 // Properties should not return arrays
 52
 53        /// <summary>
 54        /// If the Content-Encoding request header has previously been set for the file, the Content-Encoding value is r
 55        /// </summary>
 1056        public IEnumerable<string> ContentEncoding => _rawStorageFileProperties.ContentEncoding;
 57
 58        /// <summary>
 59        /// If the Cache-Control request header has previously been set for the file, the Cache-Control value is returne
 60        /// </summary>
 661        public string CacheControl => _rawStorageFileProperties.CacheControl;
 62
 63        /// <summary>
 64        /// Returns the value that was specified for the 'x-ms-content-disposition' header and specifies how to process 
 65        /// </summary>
 666        public string ContentDisposition => _rawStorageFileProperties.ContentDisposition;
 67
 68        /// <summary>
 69        /// Returns the value that was specified for the Content-Language request header.
 70        /// </summary>
 1071        public IEnumerable<string> ContentLanguage => _rawStorageFileProperties.ContentLanguage;
 72
 73        /// <summary>
 74        /// Conclusion time of the last attempted Copy File operation where this file was the destination file. This val
 75        /// </summary>
 276        public DateTimeOffset CopyCompletedOn => _rawStorageFileProperties.CopyCompletionTime;
 77
 78        /// <summary>
 79        /// Only appears when x-ms-copy-status is failed or pending. Describes cause of fatal or non-fatal copy operatio
 80        /// </summary>
 281        public string CopyStatusDescription => _rawStorageFileProperties.CopyStatusDescription;
 82
 83        /// <summary>
 84        /// String identifier for the last attempted Copy File operation where this file was the destination file.
 85        /// </summary>
 286        public string CopyId => _rawStorageFileProperties.CopyId;
 87
 88        /// <summary>
 89        /// Contains the number of bytes copied and the total bytes in the source in the last attempted Copy File operat
 90        /// </summary>
 291        public string CopyProgress => _rawStorageFileProperties.CopyProgress;
 92
 93        /// <summary>
 94        /// URL up to 2KB in length that specifies the source file used in the last attempted Copy File operation where 
 95        /// </summary>
 296        public string CopySource => _rawStorageFileProperties.CopySource;
 97
 98        /// <summary>
 99        /// State of the copy operation identified by 'x-ms-copy-id'.
 100        /// </summary>
 4101        public CopyStatus CopyStatus => _rawStorageFileProperties.CopyStatus;
 102
 103        /// <summary>
 104        /// The value of this header is set to true if the file data and application metadata are completely encrypted u
 105        /// </summary>
 4106        public bool IsServerEncrypted => _rawStorageFileProperties.IsServerEncrypted;
 107
 108        /// <summary>
 109        /// The SMB properties for the file
 110        /// </summary>
 90111        public FileSmbProperties SmbProperties { get; set; }
 112
 113        /// <summary>
 114        /// When a file is leased, specifies whether the lease is of infinite or fixed duration.
 115        /// </summary>
 2116        public ShareLeaseDuration LeaseDuration => _rawStorageFileProperties.LeaseDuration;
 117
 118        /// <summary>
 119        /// Lease state of the file.
 120        /// </summary>
 2121        public ShareLeaseState LeaseState => _rawStorageFileProperties.LeaseState;
 122
 123        /// <summary>
 124        /// The current lease status of the file.
 125        /// </summary>
 2126        public ShareLeaseStatus LeaseStatus => _rawStorageFileProperties.LeaseStatus;
 127
 74128        internal ShareFileProperties(RawStorageFileProperties rawStorageFileProperties)
 129        {
 74130            _rawStorageFileProperties = rawStorageFileProperties;
 74131            SmbProperties = new FileSmbProperties(rawStorageFileProperties);
 74132        }
 133    }
 134
 135    /// <summary>
 136    /// FilesModelFactory provides utilities for mocking.
 137    /// </summary>
 138    public static partial class FilesModelFactory
 139    {
 140        /// <summary>
 141        /// Creates a new StorageFileProperties instance for mocking.
 142        /// </summary>
 143        public static ShareFileProperties StorageFileProperties(
 144            DateTimeOffset lastModified,
 145            IDictionary<string, string> metadata,
 146            long contentLength,
 147            string contentType,
 148            ETag eTag,
 149            byte[] contentHash,
 150            IEnumerable<string> contentEncoding,
 151            string cacheControl,
 152            string contentDisposition,
 153            IEnumerable<string> contentLanguage,
 154            DateTimeOffset copyCompletedOn,
 155            string copyStatusDescription,
 156            string copyId,
 157            string copyProgress,
 158            string copySource,
 159            CopyStatus copyStatus,
 160            bool isServerEncrypted,
 161            string fileAttributes,
 162            DateTimeOffset fileCreationTime,
 163            DateTimeOffset fileLastWriteTime,
 164            DateTimeOffset fileChangeTime,
 165            string filePermissionKey,
 166            string fileId,
 167            string fileParentId
 168            ) => new ShareFileProperties(new RawStorageFileProperties()
 169            {
 170                LastModified = lastModified,
 171                Metadata = metadata,
 172                ContentLength = contentLength,
 173                ContentType = contentType,
 174                ETag = eTag,
 175                ContentHash = contentHash,
 176                ContentEncoding = contentEncoding,
 177                CacheControl = cacheControl,
 178                ContentDisposition = contentDisposition,
 179                ContentLanguage = contentLanguage,
 180                CopyCompletionTime = copyCompletedOn,
 181                CopyStatusDescription = copyStatusDescription,
 182                CopyId = copyId,
 183                CopyProgress = copyProgress,
 184                CopySource = copySource,
 185                CopyStatus = copyStatus,
 186                IsServerEncrypted = isServerEncrypted,
 187                FileAttributes = fileAttributes,
 188                FilePermissionKey = filePermissionKey,
 189                FileCreationTime = fileCreationTime,
 190                FileLastWriteTime = fileLastWriteTime,
 191                FileChangeTime = fileChangeTime,
 192                FileId = fileId,
 193                FileParentId = fileParentId
 194            });
 195    }
 196}