< Summary

Class:Azure.Storage.Files.Shares.Models.SharesModelFactory
Assembly:Azure.Storage.Files.Shares
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Files.Shares\src\Models\FileSmbProperties.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Files.Shares\src\Models\ShareDirectoryInfo.cs
Covered lines:0
Uncovered lines:18
Coverable lines:18
Total lines:224
Line coverage:0% (0 of 18)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
FileSmbProperties(...)-0%100%
StorageDirectoryInfo(...)-0%100%

File(s)

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Collections.Generic;
 6using System.ComponentModel;
 7using System.Globalization;
 8using System.Linq;
 9using System.Text;
 10
 11#pragma warning disable SA1402 // File may only contain a single type
 12
 13namespace Azure.Storage.Files.Shares.Models
 14{
 15    /// <summary>
 16    /// The SMB properties for a file.
 17    /// </summary>
 18    public class FileSmbProperties
 19    {
 20        /// <summary>
 21        /// The file system attributes for this file.
 22        /// </summary>
 23        public NtfsFileAttributes? FileAttributes { get; set; }
 24
 25        /// <summary>
 26        /// The key of the file permission.
 27        /// </summary>
 28        public string FilePermissionKey { get; set; }
 29
 30        /// <summary>
 31        /// The creation time of the file.
 32        /// </summary>
 33        public DateTimeOffset? FileCreatedOn { get; set; }
 34
 35        /// <summary>
 36        /// The last write time of the file.
 37        /// </summary>
 38        public DateTimeOffset? FileLastWrittenOn { get; set; }
 39
 40        /// <summary>
 41        /// The change time of the file.
 42        /// </summary>
 43        public DateTimeOffset? FileChangedOn { get; internal set; }
 44
 45        /// <summary>
 46        /// The fileId of the file.
 47        /// </summary>
 48        public string FileId { get; internal set; }
 49
 50        /// <summary>
 51        /// The parentId of the file
 52        /// </summary>
 53        public string ParentId { get; internal set; }
 54
 55        internal FileSmbProperties()
 56        {
 57        }
 58
 59        internal FileSmbProperties(RawStorageFileInfo rawStorageFileInfo)
 60        {
 61            FileAttributes = ShareExtensions.ToFileAttributes(rawStorageFileInfo.FileAttributes);
 62            FilePermissionKey = rawStorageFileInfo.FilePermissionKey;
 63            FileCreatedOn = rawStorageFileInfo.FileCreationTime;
 64            FileLastWrittenOn = rawStorageFileInfo.FileLastWriteTime;
 65            FileChangedOn = rawStorageFileInfo.FileChangeTime;
 66            FileId = rawStorageFileInfo.FileId;
 67            ParentId = rawStorageFileInfo.FileParentId;
 68
 69        }
 70
 71        internal FileSmbProperties(RawStorageFileProperties rawStorageFileProperties)
 72        {
 73            FileAttributes = ShareExtensions.ToFileAttributes(rawStorageFileProperties.FileAttributes);
 74            FilePermissionKey = rawStorageFileProperties.FilePermissionKey;
 75            FileCreatedOn = rawStorageFileProperties.FileCreationTime;
 76            FileLastWrittenOn = rawStorageFileProperties.FileLastWriteTime;
 77            FileChangedOn = rawStorageFileProperties.FileChangeTime;
 78            FileId = rawStorageFileProperties.FileId;
 79            ParentId = rawStorageFileProperties.FileParentId;
 80        }
 81
 82        internal FileSmbProperties(FlattenedStorageFileProperties flattenedStorageFileProperties)
 83        {
 84            FileAttributes = ShareExtensions.ToFileAttributes(flattenedStorageFileProperties.FileAttributes);
 85            FilePermissionKey = flattenedStorageFileProperties.FilePermissionKey;
 86            FileCreatedOn = flattenedStorageFileProperties.FileCreationTime;
 87            FileLastWrittenOn = flattenedStorageFileProperties.FileLastWriteTime;
 88            FileChangedOn = flattenedStorageFileProperties.FileChangeTime;
 89            FileId = flattenedStorageFileProperties.FileId;
 90            ParentId = flattenedStorageFileProperties.FileParentId;
 91        }
 92
 93        internal FileSmbProperties(RawStorageDirectoryInfo rawStorageDirectoryInfo)
 94        {
 95            FileAttributes = ShareExtensions.ToFileAttributes(rawStorageDirectoryInfo.FileAttributes);
 96            FilePermissionKey = rawStorageDirectoryInfo.FilePermissionKey;
 97            FileCreatedOn = rawStorageDirectoryInfo.FileCreationTime;
 98            FileLastWrittenOn = rawStorageDirectoryInfo.FileLastWriteTime;
 99            FileChangedOn = rawStorageDirectoryInfo.FileChangeTime;
 100            FileId = rawStorageDirectoryInfo.FileId;
 101            ParentId = rawStorageDirectoryInfo.FileParentId;
 102        }
 103
 104        internal FileSmbProperties(RawStorageDirectoryProperties rawStorageDirectoryProperties)
 105        {
 106            FileAttributes = ShareExtensions.ToFileAttributes(rawStorageDirectoryProperties.FileAttributes);
 107            FilePermissionKey = rawStorageDirectoryProperties.FilePermissionKey;
 108            FileCreatedOn = rawStorageDirectoryProperties.FileCreationTime;
 109            FileLastWrittenOn = rawStorageDirectoryProperties.FileLastWriteTime;
 110            FileChangedOn = rawStorageDirectoryProperties.FileChangeTime;
 111            FileId = rawStorageDirectoryProperties.FileId;
 112            ParentId = rawStorageDirectoryProperties.FileParentId;
 113        }
 114
 115        /// <summary>
 116        /// Checks if two FileSmbProperties are equal.
 117        /// </summary>
 118        /// <param name="other">The other instance to compare to.</param>
 119        /// <returns></returns>
 120        [EditorBrowsable(EditorBrowsableState.Never)]
 121        public override bool Equals(object other)
 122            => base.Equals(other);
 123
 124        /// <summary>
 125        /// Gets the hash code for the FileSmbProperties.
 126        /// </summary>
 127        /// <returns></returns>
 128        [EditorBrowsable(EditorBrowsableState.Never)]
 129        public override int GetHashCode() => base.GetHashCode();
 130    }
 131
 132     /// <summary>
 133     /// FilesModelFactory provides utilities for mocking.
 134     /// </summary>
 135    public static partial class SharesModelFactory
 136    {
 137        /// <summary>
 138        /// Creates a new FileSmbProperties instance for mocking.
 139        /// </summary>
 140        public static FileSmbProperties FileSmbProperties(
 141            DateTimeOffset? fileChangedOn,
 142            string fileId,
 0143            string parentId) => new FileSmbProperties
 0144            {
 0145                FileChangedOn = fileChangedOn,
 0146                FileId = fileId,
 0147                ParentId = parentId
 0148            };
 149    }
 150}

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Collections.Generic;
 6using System.Text;
 7
 8#pragma warning disable SA1402  // File may only contain a single type
 9
 10namespace Azure.Storage.Files.Shares.Models
 11{
 12    /// <summary>
 13    /// Subset of the directory's properties.
 14    /// </summary>
 15    public class ShareDirectoryInfo
 16    {
 17        internal RawStorageDirectoryInfo _rawStorageDirectoryInfo;
 18
 19        /// <summary>
 20        /// The ETag contains a value which represents the version of the directory, in quotes.
 21        /// </summary>
 22        public ETag ETag => _rawStorageDirectoryInfo.ETag;
 23
 24        /// <summary>
 25        /// Returns the date and time the directory was last modified. Any operation that modifies the directory or
 26        /// its properties updates the last modified time. Operations on files do not affect the last modified time of t
 27        /// </summary>
 28        public DateTimeOffset LastModified => _rawStorageDirectoryInfo.LastModified;
 29
 30        /// <summary>
 31        /// The directory's SMB properties.
 32        /// </summary>
 33        public FileSmbProperties SmbProperties { get; set; }
 34
 35        internal ShareDirectoryInfo(RawStorageDirectoryInfo rawStorageDirectoryInfo)
 36        {
 37            _rawStorageDirectoryInfo = rawStorageDirectoryInfo;
 38            SmbProperties = new FileSmbProperties(rawStorageDirectoryInfo);
 39        }
 40    }
 41
 42    /// <summary>
 43    /// FilesModelFactory provides utilities for mocking.
 44    /// </summary>
 45    public static partial class SharesModelFactory
 46    {
 47        /// <summary>
 48        /// Creates a new StorageDirectoryInfo instance for mocking.
 49        /// </summary>
 50        public static ShareDirectoryInfo StorageDirectoryInfo(
 51            ETag eTag,
 52            DateTimeOffset lastModified,
 53            string filePermissionKey,
 54            string fileAttributes,
 55            DateTimeOffset fileCreationTime,
 56            DateTimeOffset fileLastWriteTime,
 57            DateTimeOffset fileChangeTime,
 58            string fileId,
 59            string fileParentId
 60            )
 061            => new ShareDirectoryInfo(new RawStorageDirectoryInfo
 062            {
 063                ETag = eTag,
 064                LastModified = lastModified,
 065                FilePermissionKey = filePermissionKey,
 066                FileAttributes = fileAttributes,
 067                FileCreationTime = fileCreationTime,
 068                FileLastWriteTime = fileLastWriteTime,
 069                FileChangeTime = fileChangeTime,
 070                FileId = fileId,
 071                FileParentId = fileParentId
 072            });
 73    }
 74}