diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Common/Setup/SkipWhenHiddenAttributeNotSupportedFactAttribute.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Common/Setup/SkipWhenHiddenAttributeNotSupportedFactAttribute.cs
new file mode 100644
index 00000000..91fc85fc
--- /dev/null
+++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Common/Setup/SkipWhenHiddenAttributeNotSupportedFactAttribute.cs
@@ -0,0 +1,20 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Presentation.Api.IntegrationTests.Core.Endpoints.FileSystemManagement.Fixtures;
+using System;
+using System.IO;
+using Xunit;
+#endregion
+
+namespace Lumina.Presentation.Api.IntegrationTests.Common.Setup;
+
+///
+/// Marks a test to be skipped when the file system does not support the attribute.
+///
+[AttributeUsage(AttributeTargets.Method)]
+public sealed class SkipWhenHiddenAttributeNotSupportedFactAttribute : FactAttribute
+{
+ ///
+ public override string Skip => FileSystemStructureFixture.HiddenAttributeIsSupported
+ ? string.Empty
+ : "The file system does not support the hidden file attribute, so the hidden elements scenario cannot be set up.";
+}
diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Directories/GetDirectoriesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Directories/GetDirectoriesEndpointTests.cs
index 5ba888d9..a8608cfd 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Directories/GetDirectoriesEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Directories/GetDirectoriesEndpointTests.cs
@@ -52,7 +52,7 @@ public class GetDirectoriesEndpointTests : IClassFixture
+ /// Gets a value indicating whether the fixture can create hidden elements on the current platform and file system.
+ ///
+ internal static bool HiddenAttributeIsSupported => s_hiddenAttributeIsSupported;
+
///
/// Initializes a new instance of the class.
///
@@ -57,10 +63,48 @@ public class FileSystemStructureFixture
return currentPath;
}
+ ///
+ /// Detects whether the fixture can create hidden elements on the current platform and file system.
+ ///
+ /// when hidden elements can be created, otherwise .
+ private static bool DetectHiddenAttributeSupport()
+ {
+ // on Unix-like systems the fixture hides elements with the dot-prefix convention, which the file system always supports
+ if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS())
+ return true;
+ // on Windows the fixture relies on the hidden file attribute, which some file systems (for example network drives) do not persist
+ string probePath = System.IO.Path.Combine(AppContext.BaseDirectory, "lumina_hidden_attribute_probe_" + Guid.NewGuid());
+ try
+ {
+ File.WriteAllText(probePath, string.Empty);
+ File.SetAttributes(probePath, File.GetAttributes(probePath) | FileAttributes.Hidden);
+ return (File.GetAttributes(probePath) & FileAttributes.Hidden) == FileAttributes.Hidden;
+ }
+ catch
+ {
+ return false;
+ }
+ finally
+ {
+ if (File.Exists(probePath))
+ {
+ try
+ {
+ File.SetAttributes(probePath, FileAttributes.Normal);
+ File.Delete(probePath);
+ }
+ catch
+ {
+ }
+ }
+ }
+ }
+
///
/// Sets the hidden attribute for a file or directory.
///
/// The path to the file or directory.
+ /// The path to the hidden file or directory.
private static string SetHidden(string path)
{
if (OperatingSystem.IsWindows())
diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BooksLibrary/Books/Commands/AddBook/AddBookCommandHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BooksLibrary/Books/Commands/AddBook/AddBookCommandHandlerTests.cs
index 304322a5..7b2cbdb4 100644
--- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BooksLibrary/Books/Commands/AddBook/AddBookCommandHandlerTests.cs
+++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BooksLibrary/Books/Commands/AddBook/AddBookCommandHandlerTests.cs
@@ -71,23 +71,6 @@ public class AddBookCommandHandlerTests
await _mockUnitOfWork.Received(1).SaveChangesAsync(Arg.Any());
}
- [Fact]
- public async Task Handle_WhenBookCreationFails_ShouldReturnFailureResult()
- {
- // Arrange
- AddBookCommand bookCommand = _commandBookFixture.CreateCommandBook();
- bookCommand = bookCommand with { Metadata = bookCommand.Metadata! with { Title = null } };
-
- // Act
- ErrorOr result = await _sut.Handle(bookCommand, CancellationToken.None);
-
- // Assert
- Assert.True(result.IsError);
- Assert.Contains(result.Errors, e => e.Description == Errors.Metadata.TitleCannotBeEmpty.Description);
- await _mockBookRepository.DidNotReceive().InsertAsync(Arg.Any(), Arg.Any());
- await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any());
- }
-
[Fact]
public async Task Handle_WhenRepositoryInsertFails_ShouldReturnFailureResult()
{