mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 02:11:10 +00:00
Adds unlit color to hidden file system browser dialog elements.
This commit is contained in:
1 parent
3f7cc2c60f
commit
b46dce745b
58 files changed
+855
-360
No files matched your search
+4
-2
@@ -19,14 +19,16 @@ public class FileSystemItemDtoFixture
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="FileSystemItemDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="isHidden">Optional. Whether the file system item is hidden. If not provided, a random value is generated.</param>
|
||||
/// <returns>The created <see cref="FileSystemItemDto"/>.</returns>
|
||||
public FileSystemItemDto Create()
|
||||
public FileSystemItemDto Create(bool? isHidden = null)
|
||||
{
|
||||
return new FileSystemItemDto(
|
||||
_faker.System.FilePath(),
|
||||
_faker.System.FileName(),
|
||||
_faker.Date.Past(),
|
||||
_faker.Date.Recent()
|
||||
_faker.Date.Recent(),
|
||||
isHidden ?? _faker.Random.Bool()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -23,14 +23,16 @@ public class FileSystemTreeNodeResponseFixture
|
||||
/// <param name="currentDepth">The current depth in the tree structure. Default is 0 (root level).</param>
|
||||
/// <param name="maxDepth">The maximum depth of the tree structure. Default is 2.</param>
|
||||
/// <param name="maxChildren">The maximum number of children for each node. Default is 3.</param>
|
||||
/// <param name="isHidden">Optional. Whether the node is hidden. If not provided, a random value is generated.</param>
|
||||
/// <returns>A <see cref="FileSystemTreeNodeResponse"/> with a nested structure.</returns>
|
||||
public FileSystemTreeNodeResponse Create(int currentDepth = 0, int maxDepth = 2, int maxChildren = 3)
|
||||
public FileSystemTreeNodeResponse Create(int currentDepth = 0, int maxDepth = 2, int maxChildren = 3, bool? isHidden = null)
|
||||
{
|
||||
FileSystemTreeNodeResponse response = new()
|
||||
{
|
||||
Path = _faker.System.FilePath(),
|
||||
Name = _faker.System.FileName(),
|
||||
ItemType = FileSystemItemType.Directory,
|
||||
IsHidden = isHidden ?? _faker.Random.Bool(),
|
||||
IsExpanded = _faker.Random.Bool(),
|
||||
ChildrenLoaded = true,
|
||||
Children = []
|
||||
|
||||
+4
-2
@@ -22,15 +22,17 @@ public class DirectoryResponseFixture
|
||||
/// Creates a random valid <see cref="DirectoryResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="itemCount">Optional. The number of children elements to create.</param>
|
||||
/// <param name="isHidden">Optional. Whether the directory is hidden. If not provided, a random value is generated.</param>
|
||||
/// <returns>The created <see cref="DirectoryResponse"/>.</returns>
|
||||
public DirectoryResponse Create(int itemCount = 3)
|
||||
public DirectoryResponse Create(int itemCount = 3, bool? isHidden = null)
|
||||
{
|
||||
return new DirectoryResponse(
|
||||
_faker.System.FilePath(),
|
||||
_faker.System.FileName(),
|
||||
_faker.Date.Past(),
|
||||
_faker.Date.Recent(),
|
||||
_fileSystemItemDtoFixture.CreateMany(itemCount)
|
||||
_fileSystemItemDtoFixture.CreateMany(itemCount),
|
||||
isHidden ?? _faker.Random.Bool()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -19,15 +19,17 @@ public class FileResponseFixture
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="FileResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="isHidden">Optional. Whether the file is hidden. If not provided, a random value is generated.</param>
|
||||
/// <returns>The created <see cref="FileResponse"/>.</returns>
|
||||
public FileResponse Create()
|
||||
public FileResponse Create(bool? isHidden = null)
|
||||
{
|
||||
return new FileResponse(
|
||||
_faker.System.FilePath(),
|
||||
_faker.System.FileName(),
|
||||
_faker.Date.Past(),
|
||||
_faker.Date.Recent(),
|
||||
_faker.Random.Long()
|
||||
_faker.Random.Long(),
|
||||
isHidden ?? _faker.Random.Bool()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -28,6 +28,7 @@ public class DirectoryFixture
|
||||
/// <param name="dateCreated">Optional. The directory's creation date. If not provided, a random past date is generated.</param>
|
||||
/// <param name="dateModified">Optional. The directory's modification date. If not provided, a recent date is generated.</param>
|
||||
/// <param name="status">Optional. The directory's status. If not provided, a random status is assigned.</param>
|
||||
/// <param name="isHidden">Optional. Whether the directory is hidden. If not provided, a random value is generated.</param>
|
||||
/// <param name="childItems">Optional. A list of child items to be added to the directory.</param>
|
||||
/// <returns>A newly created <see cref="Directory"/> instance.</returns>
|
||||
/// <exception cref="InvalidOperationException">Thrown if the <see cref="Directory"/> creation fails.</exception>
|
||||
@@ -37,6 +38,7 @@ public class DirectoryFixture
|
||||
Optional<DateTime>? dateCreated = null,
|
||||
Optional<DateTime>? dateModified = null,
|
||||
FileSystemItemStatus? status = null,
|
||||
bool? isHidden = null,
|
||||
List<FileSystemItem>? childItems = null)
|
||||
{
|
||||
path ??= _faker.System.FilePath();
|
||||
@@ -44,8 +46,9 @@ public class DirectoryFixture
|
||||
dateCreated ??= Optional<DateTime>.Some(_faker.Date.Past());
|
||||
dateModified ??= Optional<DateTime>.Some(_faker.Date.Recent());
|
||||
status ??= _faker.PickRandom<FileSystemItemStatus>();
|
||||
isHidden ??= _faker.Random.Bool();
|
||||
|
||||
Result<Directory> directoryResult = Directory.Create(path, name, dateCreated.Value, dateModified.Value, status.Value);
|
||||
Result<Directory> directoryResult = Directory.Create(path, name, dateCreated.Value, dateModified.Value, status.Value, isHidden.Value);
|
||||
|
||||
if (directoryResult.IsFailure)
|
||||
throw new InvalidOperationException("Failed to create Directory: " + string.Join(", ", directoryResult.Errors));
|
||||
|
||||
+4
-1
@@ -28,6 +28,7 @@ public class FileFixture
|
||||
/// <param name="dateModified">Optional. The file's modification date. If not provided, a recent date is generated.</param>
|
||||
/// <param name="size">Optional. The file size. If not provided, a random size is generated.</param>
|
||||
/// <param name="status">Optional. The file's status. If not provided, a random status is assigned.</param>
|
||||
/// <param name="isHidden">Optional. Whether the file is hidden. If not provided, a random value is generated.</param>
|
||||
/// <param name="includeDates">Whether the creation and modification dates should be included, or left unset.</param>
|
||||
/// <returns>The created <see cref="File"/>.</returns>
|
||||
public File Create(
|
||||
@@ -37,6 +38,7 @@ public class FileFixture
|
||||
Optional<DateTime>? dateModified = null,
|
||||
long? size = null,
|
||||
FileSystemItemStatus? status = null,
|
||||
bool? isHidden = null,
|
||||
bool includeDates = true)
|
||||
{
|
||||
path ??= _faker.System.FilePath();
|
||||
@@ -45,8 +47,9 @@ public class FileFixture
|
||||
dateModified ??= includeDates ? Optional<DateTime>.Some(_faker.Date.Recent()) : Optional<DateTime>.None();
|
||||
size ??= _faker.Random.Long();
|
||||
status ??= _faker.PickRandom<FileSystemItemStatus>();
|
||||
isHidden ??= _faker.Random.Bool();
|
||||
|
||||
Result<File> fileResult = File.Create(path, name, dateCreated.Value, dateModified.Value, size.Value, status.Value);
|
||||
Result<File> fileResult = File.Create(path, name, dateCreated.Value, dateModified.Value, size.Value, status.Value, isHidden.Value);
|
||||
|
||||
if (fileResult.IsFailure)
|
||||
throw new InvalidOperationException("Failed to create File: " + string.Join(", ", fileResult.Errors));
|
||||
|
||||
+3
@@ -22,12 +22,14 @@ public class DirectoryDtoFixture
|
||||
/// </summary>
|
||||
/// <param name="path">Optional. The full path to the directory.</param>
|
||||
/// <param name="name">Optional. The name of the directory.</param>
|
||||
/// <param name="isHidden">Optional. Whether the directory is hidden. If not provided, a random value is generated.</param>
|
||||
/// <param name="items">Optional. The children items of the directory.</param>
|
||||
/// <param name="includeItems">Whether the children items should be included, or forced to an empty collection.</param>
|
||||
/// <returns>The created <see cref="DirectoryDto"/>.</returns>
|
||||
public DirectoryDto Create(
|
||||
string? path = null,
|
||||
string? name = null,
|
||||
bool? isHidden = null,
|
||||
List<FileSystemItemDto>? items = null,
|
||||
bool includeItems = false)
|
||||
{
|
||||
@@ -38,6 +40,7 @@ public class DirectoryDtoFixture
|
||||
Name = name ?? Path.GetFileName(generatedPath),
|
||||
DateCreated = _faker.Date.Past(),
|
||||
DateModified = _faker.Date.Recent(),
|
||||
IsHidden = isHidden ?? _faker.Random.Bool(),
|
||||
Items = includeItems ? (items ?? []) : []
|
||||
};
|
||||
}
|
||||
|
||||
+4
-1
@@ -23,11 +23,13 @@ public class FileDtoFixture
|
||||
/// <param name="path">Optional. The full path to the file.</param>
|
||||
/// <param name="name">Optional. The name of the file.</param>
|
||||
/// <param name="size">Optional. The size of the file, in bytes.</param>
|
||||
/// <param name="isHidden">Optional. Whether the file is hidden. If not provided, a random value is generated.</param>
|
||||
/// <returns>A configured <see cref="FileDto"/> instance.</returns>
|
||||
public FileDto Create(
|
||||
string? path = null,
|
||||
string? name = null,
|
||||
long? size = null)
|
||||
long? size = null,
|
||||
bool? isHidden = null)
|
||||
{
|
||||
string generatedPath = _faker.System.FilePath();
|
||||
return new FileDto
|
||||
@@ -36,6 +38,7 @@ public class FileDtoFixture
|
||||
Name = name ?? Path.GetFileName(generatedPath),
|
||||
DateCreated = _faker.Date.Past(),
|
||||
DateModified = _faker.Date.Recent(),
|
||||
IsHidden = isHidden ?? _faker.Random.Bool(),
|
||||
Size = size ?? _faker.Random.Long(0, 10_000_000)
|
||||
};
|
||||
}
|
||||
|
||||
+4
-1
@@ -24,11 +24,13 @@ public class FileSystemTreeNodeDtoFixture
|
||||
/// <param name="path">Optional. The full path of the file or directory.</param>
|
||||
/// <param name="name">Optional. The name of the file or directory.</param>
|
||||
/// <param name="itemType">Optional. The type of the item, indicating whether it is a file, directory, or drive.</param>
|
||||
/// <param name="isHidden">Optional. Whether the node is hidden. If not provided, a random value is generated.</param>
|
||||
/// <returns>A configured <see cref="FileSystemTreeNodeDto"/> instance.</returns>
|
||||
public FileSystemTreeNodeDto Create(
|
||||
string? path = null,
|
||||
string? name = null,
|
||||
FileSystemItemType? itemType = null)
|
||||
FileSystemItemType? itemType = null,
|
||||
bool? isHidden = null)
|
||||
{
|
||||
string generatedPath = _faker.System.FilePath();
|
||||
return new FileSystemTreeNodeDto
|
||||
@@ -36,6 +38,7 @@ public class FileSystemTreeNodeDtoFixture
|
||||
Path = path ?? generatedPath,
|
||||
Name = name ?? Path.GetFileName(generatedPath),
|
||||
ItemType = itemType ?? _faker.PickRandom<FileSystemItemType>(),
|
||||
IsHidden = isHidden ?? _faker.Random.Bool(),
|
||||
IsExpanded = _faker.Random.Bool(),
|
||||
ChildrenLoaded = _faker.Random.Bool(),
|
||||
Children = []
|
||||
|
||||
Reference in new issue
Block a user