| | | 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 | | |
| | | 6 | | namespace Azure.Storage.Files.Shares.Models |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Describes a file or directory returned by |
| | | 10 | | /// <see cref="ShareDirectoryClient.GetFilesAndDirectoriesAsync"/>. |
| | | 11 | | /// </summary> |
| | | 12 | | public class ShareFileItem |
| | | 13 | | { |
| | | 14 | | /// <summary> |
| | | 15 | | /// Gets a value indicating whether this item is a directory. |
| | | 16 | | /// </summary> |
| | 60 | 17 | | public bool IsDirectory { get; } |
| | | 18 | | |
| | | 19 | | /// <summary> |
| | | 20 | | /// Gets the name of this item. |
| | | 21 | | /// </summary> |
| | 80 | 22 | | public string Name { get; } |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// Gets an optional value indicating the file size, if this item is |
| | | 26 | | /// a file. |
| | | 27 | | /// </summary> |
| | 0 | 28 | | public long? FileSize { get; } |
| | | 29 | | |
| | 80 | 30 | | internal ShareFileItem(bool isDirectory, string name, long? fileSize = null) |
| | | 31 | | { |
| | 80 | 32 | | IsDirectory = isDirectory; |
| | 80 | 33 | | Name = name; |
| | 80 | 34 | | FileSize = fileSize; |
| | 80 | 35 | | } |
| | | 36 | | } |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// FilesModelFactory provides utilities for mocking. |
| | | 40 | | /// </summary> |
| | | 41 | | public static partial class FilesModelFactory |
| | | 42 | | { |
| | | 43 | | /// <summary> |
| | | 44 | | /// Creates a new StorageFileItem instance for mocking. |
| | | 45 | | /// </summary> |
| | | 46 | | public static ShareFileItem StorageFileItem( |
| | | 47 | | bool isDirectory, string name, long? fileSize) => |
| | | 48 | | new ShareFileItem(isDirectory, name, fileSize); |
| | | 49 | | } |
| | | 50 | | } |