mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 15:11:10 +00:00
Replaces MVC with FastEndpoints in Lumina.Presentation.Api
This commit is contained in:
1 parent
b1a20716df
commit
c7b8bc2f1c
519 files changed
+15329
-8539
No files matched your search
-31
@@ -1,31 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Entities.Fixtures;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UnixRootItem"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UnixRootItemFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="UnixRootItem"/>.
|
||||
/// </summary>
|
||||
/// <param name="status">The status of the UNIX root item.</param>
|
||||
/// <returns>The created <see cref="UnixRootItem"/>.</returns>
|
||||
public UnixRootItem CreateUnixRootItem(FileSystemItemStatus status = FileSystemItemStatus.Accessible)
|
||||
{
|
||||
ErrorOr<UnixRootItem> unixRootItemResult = UnixRootItem.Create(status);
|
||||
|
||||
if (unixRootItemResult.IsError)
|
||||
throw new InvalidOperationException("Failed to create UnixRootItem: " + string.Join(", ", unixRootItemResult.Errors));
|
||||
return unixRootItemResult.Value;
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -2,17 +2,17 @@
|
||||
using ErrorOr;
|
||||
using FluentAssertions;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Fixtures;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Fixtures;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Entities;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="Directory"/> class.
|
||||
@@ -55,7 +55,7 @@ public class DirectoryTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
+5
-5
@@ -4,13 +4,13 @@ using FluentAssertions;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Entities;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="File"/> class.
|
||||
@@ -56,7 +56,7 @@ public class FileTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -150,7 +150,7 @@ public class FileTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.NameCannotBeEmpty);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.NameCannotBeEmpty);
|
||||
file.Name.Should().Be("file.txt");
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -3,15 +3,15 @@ using Bogus;
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Entities.Fixtures;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Entities.Fixtures;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="Directory"/> class.
|
||||
+2
-2
@@ -3,14 +3,14 @@ using Bogus;
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Entities.Fixtures;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Entities.Fixtures;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="File"/> class.
|
||||
+5
-5
@@ -3,13 +3,13 @@ using ErrorOr;
|
||||
using FluentAssertions;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Entities;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="UnixRootItem"/> class.
|
||||
@@ -92,13 +92,13 @@ public class UnixRootItemTests
|
||||
ErrorOr<UnixRootItem> createResult = UnixRootItem.Create();
|
||||
createResult.IsError.Should().BeFalse();
|
||||
UnixRootItem unixRootItem = createResult.Value;
|
||||
|
||||
|
||||
// Act
|
||||
ErrorOr<Updated> result = unixRootItem.SetParent(null!);
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.ParentNodeCannotBeNull);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.ParentNodeCannotBeNull);
|
||||
unixRootItem.Parent.HasValue.Should().BeFalse();
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -3,14 +3,14 @@ using ErrorOr;
|
||||
using FluentAssertions;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Entities;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="WindowsRootItem"/> class.
|
||||
@@ -50,7 +50,7 @@ public class WindowsRootItemTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -140,7 +140,7 @@ public class WindowsRootItemTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.ParentNodeCannotBeNull);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.ParentNodeCannotBeNull);
|
||||
windowsRootItem.Parent.HasValue.Should().BeFalse();
|
||||
}
|
||||
}
|
||||
+6
-7
@@ -6,15 +6,14 @@ using FluentAssertions;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Fixtures;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects.Fixtures;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Fixtures;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects.Fixtures;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="FileSystemItem"/> class.
|
||||
@@ -96,7 +95,7 @@ public class FileSystemItemTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.ParentNodeCannotBeNull);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.ParentNodeCannotBeNull);
|
||||
item.Parent.Should().Be(Optional<FileSystemItem>.None());
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Fixtures;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Fixtures;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="FileSystemItem"/> class.
|
||||
+32
-31
@@ -6,9 +6,9 @@ using FluentAssertions;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects.Fixtures;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects.Fixtures;
|
||||
using NSubstitute;
|
||||
using NSubstitute.ExceptionExtensions;
|
||||
using System;
|
||||
@@ -22,7 +22,7 @@ using System.Text;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="DirectoryProviderService"/> class.
|
||||
@@ -174,16 +174,16 @@ public class DirectoryProviderServiceTests
|
||||
{
|
||||
// Arrange
|
||||
FileSystemPathId path = _fileSystemPathIdFixture.CreateFileSystemPathId();
|
||||
string[] subdirectories = s_isLinux
|
||||
? new[] { "/C", "/A", "/B" }
|
||||
: new[] { @"C:\C", @"C:\A", @"C:\B" };
|
||||
string[] subdirectories = s_isLinux
|
||||
? ["/C", "/A", "/B"]
|
||||
: [@"C:\C", @"C:\A", @"C:\B"];
|
||||
_mockFileSystemPermissionsService.CanAccessPath(path, FileAccessMode.ListDirectory, false).Returns(true);
|
||||
_mockFileSystem.Directory.GetDirectories(path.Path).Returns(subdirectories);
|
||||
_mockFileSystem.Path.DirectorySeparatorChar.Returns(_dirSeparator);
|
||||
_mockFileSystem.File.GetAttributes(Arg.Any<string>()).Returns(FileAttributes.Directory);
|
||||
string[] expectedPaths = s_isLinux
|
||||
? new[] { "/A/", "/B/", "/C/" }
|
||||
: new[] { @"C:\A\", @"C:\B\", @"C:\C\" };
|
||||
string[] expectedPaths = s_isLinux
|
||||
? ["/A/", "/B/", "/C/"]
|
||||
: [@"C:\A\", @"C:\B\", @"C:\C\"];
|
||||
|
||||
// Act
|
||||
ErrorOr<IEnumerable<FileSystemPathId>> result = _sut.GetSubdirectoryPaths(path, false);
|
||||
@@ -243,8 +243,8 @@ public class DirectoryProviderServiceTests
|
||||
public void GetFileName_WhenPathIsValid_ShouldReturnFileName()
|
||||
{
|
||||
// Arrange
|
||||
string fullPath = s_isLinux
|
||||
? "/folder/subfolder/file.txt"
|
||||
string fullPath = s_isLinux
|
||||
? "/folder/subfolder/file.txt"
|
||||
: @"C:\folder\subfolder\file.txt";
|
||||
FileSystemPathId path = _fileSystemPathIdFixture.CreateFileSystemPathId(fullPath);
|
||||
_mockFileSystem.Path.GetFileName(fullPath).Returns("file.txt");
|
||||
@@ -261,8 +261,8 @@ public class DirectoryProviderServiceTests
|
||||
public void GetFileName_WhenPathEndsWithDirectorySeparator_ShouldReturnLastSegment()
|
||||
{
|
||||
// Arrange
|
||||
string fullPath = s_isLinux
|
||||
? "/folder/subfolder/"
|
||||
string fullPath = s_isLinux
|
||||
? "/folder/subfolder/"
|
||||
: @"C:\folder\subfolder\";
|
||||
FileSystemPathId path = _fileSystemPathIdFixture.CreateFileSystemPathId(fullPath);
|
||||
_mockFileSystem.Path.GetFileName(fullPath[..^1]).Returns("subfolder");
|
||||
@@ -280,8 +280,8 @@ public class DirectoryProviderServiceTests
|
||||
public void GetFileName_WhenPathIsRoot_ShouldReturnEmptyString()
|
||||
{
|
||||
// Arrange
|
||||
string fullPath = s_isLinux
|
||||
? "/C/"
|
||||
string fullPath = s_isLinux
|
||||
? "/C/"
|
||||
: @"/";
|
||||
FileSystemPathId path = _fileSystemPathIdFixture.CreateFileSystemPathId(fullPath);
|
||||
_mockFileSystem.Path.GetFileName(fullPath[..^1]).Returns(string.Empty);
|
||||
@@ -367,8 +367,8 @@ public class DirectoryProviderServiceTests
|
||||
// Arrange
|
||||
FileSystemPathId parentPath = _fileSystemPathIdFixture.CreateFileSystemPathId(@"C:\Parent");
|
||||
string directoryName = "NewDirectory";
|
||||
string fullPath = s_isLinux
|
||||
? "/Parent/NewDirectory"
|
||||
string fullPath = s_isLinux
|
||||
? "/Parent/NewDirectory"
|
||||
: @"C:\Parent\NewDirectory";
|
||||
|
||||
_mockFileSystemPermissionsService.CanAccessPath(parentPath, FileAccessMode.Write, false).Returns(true);
|
||||
@@ -484,7 +484,7 @@ public class DirectoryProviderServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.DirectoryNotFound);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.DirectoryNotFound);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -493,8 +493,8 @@ public class DirectoryProviderServiceTests
|
||||
// Arrange
|
||||
FileSystemPathId sourcePath = _fileSystemPathIdFixture.CreateFileSystemPathId(_pathSource);
|
||||
FileSystemPathId destinationPath = _fileSystemPathIdFixture.CreateFileSystemPathId(_pathDestination);
|
||||
string expectedNewDirectoryPath = s_isLinux
|
||||
? "/Destination - Copy (1)"
|
||||
string expectedNewDirectoryPath = s_isLinux
|
||||
? "/Destination - Copy (1)"
|
||||
: @"C:\Destination - Copy (1)";
|
||||
bool overrideExisting = false;
|
||||
|
||||
@@ -528,13 +528,14 @@ public class DirectoryProviderServiceTests
|
||||
FileSystemPathId sourcePath = _fileSystemPathIdFixture.CreateFileSystemPathId(_pathSource);
|
||||
FileSystemPathId destinationPath = _fileSystemPathIdFixture.CreateFileSystemPathId(_pathDestination);
|
||||
bool overrideExisting = true;
|
||||
|
||||
|
||||
|
||||
|
||||
// ensure all relevant directories exist
|
||||
_mockFileSystem.Directory.Exists(_pathSource).Returns(true);
|
||||
_mockFileSystem.Directory.Exists(_pathSourceSubDir).Returns(true);
|
||||
_mockFileSystem.Directory.Exists(_pathDestination).Returns(false);
|
||||
_mockFileSystem.Directory.CreateDirectory(Arg.Any<string>()).Returns(callInfo => {
|
||||
_mockFileSystem.Directory.CreateDirectory(Arg.Any<string>()).Returns(callInfo =>
|
||||
{
|
||||
IDirectoryInfo mockDirInfo = Substitute.For<IDirectoryInfo>();
|
||||
mockDirInfo.FullName.Returns(callInfo.Arg<string>());
|
||||
return mockDirInfo;
|
||||
@@ -591,7 +592,7 @@ public class DirectoryProviderServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.DirectoryCopyError);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.DirectoryCopyError);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -611,7 +612,7 @@ public class DirectoryProviderServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.DirectoryNotFound);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.DirectoryNotFound);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -667,7 +668,7 @@ public class DirectoryProviderServiceTests
|
||||
result.Value.Path.Should().Be(destinationPath.Path);
|
||||
_mockFileSystem.File.Received(1).Move(_pathSourceFile1, _pathDestinationFile1);
|
||||
_mockFileSystem.Directory.Received(1).Move(
|
||||
_pathSourceSubDir,
|
||||
_pathSourceSubDir,
|
||||
s_isLinux ? "/Destination/SubDir" : @"C:\Destination\SubDir"
|
||||
);
|
||||
_mockFileSystem.Directory.Received(1).Delete(sourcePath.Path);
|
||||
@@ -691,7 +692,7 @@ public class DirectoryProviderServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.DirectoryMoveError);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.DirectoryMoveError);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -835,7 +836,7 @@ public class DirectoryProviderServiceTests
|
||||
result.IsError.Should().BeFalse();
|
||||
result.Value.Should().Be(destPath);
|
||||
_mockFileSystem.File.Received(1).Move(
|
||||
s_isLinux ? "/Source/SubDir/file.txt" : @"C:\Source\SubDir\file.txt",
|
||||
s_isLinux ? "/Source/SubDir/file.txt" : @"C:\Source\SubDir\file.txt",
|
||||
s_isLinux ? "/Destination/SubDir/file.txt" : @"C:\Destination\SubDir\file.txt"
|
||||
);
|
||||
_mockFileSystem.Directory.Received(1).Delete(_pathSourceSubDir);
|
||||
@@ -938,7 +939,7 @@ public class DirectoryProviderServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
_mockFileSystem.Directory.DidNotReceive().Move(Arg.Any<string>(), Arg.Any<string>());
|
||||
}
|
||||
|
||||
@@ -962,7 +963,7 @@ public class DirectoryProviderServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
_mockFileSystem.Directory.DidNotReceive().Move(Arg.Any<string>(), Arg.Any<string>());
|
||||
}
|
||||
|
||||
+20
-21
@@ -4,13 +4,13 @@ using FluentAssertions;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Entities.Fixtures;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects.Fixtures;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Entities.Fixtures;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects.Fixtures;
|
||||
using NSubstitute;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="DirectoryService"/> class.
|
||||
@@ -38,7 +38,6 @@ public class DirectoryServiceTests
|
||||
private readonly string _pathDirTest = s_isLinux ? "/TestDir" : @"C:\TestDir";
|
||||
private readonly string _pathDirTestSubDir1 = s_isLinux ? "/TestDir/Sub1" : @"C:\TestDir\Sub1";
|
||||
private readonly string _pathDirTestSubDir2 = s_isLinux ? "/TestDir/Sub2" : @"C:\TestDir\Sub2";
|
||||
private readonly char _dirSeparator = s_isLinux ? '/' : '\\';
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DirectoryServiceTests"/> class.
|
||||
@@ -101,7 +100,7 @@ public class DirectoryServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -353,7 +352,7 @@ public class DirectoryServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -464,7 +463,7 @@ public class DirectoryServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.DirectoryAlreadyExists);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.DirectoryAlreadyExists);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -475,14 +474,14 @@ public class DirectoryServiceTests
|
||||
string newDirName = "NewDirectory";
|
||||
|
||||
_mockPlatformContext.PathStrategy.CombinePath(parentPathId, newDirName)
|
||||
.Returns(Errors.FileManagement.InvalidPath);
|
||||
.Returns(Errors.FileSystemManagement.InvalidPath);
|
||||
|
||||
// Act
|
||||
ErrorOr<Directory> result = _sut.CreateDirectory(parentPathId, newDirName);
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
|
||||
// Verify that DirectoryExists was not called
|
||||
_mockEnvironmentContext.DirectoryProviderService.DidNotReceive().DirectoryExists(Arg.Any<FileSystemPathId>());
|
||||
@@ -530,7 +529,7 @@ public class DirectoryServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -638,7 +637,7 @@ public class DirectoryServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.DirectoryAlreadyExists);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.DirectoryAlreadyExists);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -651,14 +650,14 @@ public class DirectoryServiceTests
|
||||
string newName = "NewName";
|
||||
|
||||
_mockPlatformContext.PathStrategy.CombinePath(Arg.Any<FileSystemPathId>(), newName)
|
||||
.Returns(Errors.FileManagement.InvalidPath);
|
||||
.Returns(Errors.FileSystemManagement.InvalidPath);
|
||||
|
||||
// Act
|
||||
ErrorOr<Directory> result = _sut.RenameDirectory(oldPathId, newName);
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
|
||||
// Verify that DirectoryExists and RenameDirectory were not called
|
||||
_mockEnvironmentContext.DirectoryProviderService.DidNotReceive().DirectoryExists(Arg.Any<FileSystemPathId>());
|
||||
@@ -722,7 +721,7 @@ public class DirectoryServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -772,13 +771,13 @@ public class DirectoryServiceTests
|
||||
);
|
||||
|
||||
_mockEnvironmentContext.DirectoryProviderService.DeleteDirectory(pathId)
|
||||
.Returns(Errors.FileManagement.DirectoryNotFound);
|
||||
.Returns(Errors.FileSystemManagement.DirectoryNotFound);
|
||||
|
||||
// Act
|
||||
ErrorOr<Deleted> result = _sut.DeleteDirectory(pathId);
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.DirectoryNotFound);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.DirectoryNotFound);
|
||||
}
|
||||
}
|
||||
+5
-6
@@ -2,11 +2,10 @@
|
||||
using ErrorOr;
|
||||
using FluentAssertions;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Fixtures;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using NSubstitute;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -14,7 +13,7 @@ using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="DriveService"/> class.
|
||||
+17
-18
@@ -6,9 +6,9 @@ using FluentAssertions;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects.Fixtures;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects.Fixtures;
|
||||
using NSubstitute;
|
||||
using NSubstitute.ExceptionExtensions;
|
||||
using System;
|
||||
@@ -21,7 +21,7 @@ using System.Runtime.InteropServices;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="FileProviderService"/> class.
|
||||
@@ -35,7 +35,6 @@ public class FileProviderServiceTests
|
||||
private readonly FileProviderService _sut;
|
||||
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture;
|
||||
private static readonly bool s_isLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
|
||||
private readonly string _pathDirTest = s_isLinux ? "/TestDir" : @"C:\TestDir";
|
||||
private readonly string _pathVisible1 = s_isLinux ? "/Visible.txt" : @"C:\Visible.txt";
|
||||
private readonly string _pathHidden1 = s_isLinux ? "/Hidden.txt" : @"C:\Hidden.txt";
|
||||
private readonly string _pathValid1 = s_isLinux ? "/Valid.txt" : @"C:\Valid.txt";
|
||||
@@ -44,7 +43,6 @@ public class FileProviderServiceTests
|
||||
private readonly string _pathDestinationFile = s_isLinux ? "/Destination/file.txt" : @"C:\Destination\file.txt";
|
||||
private readonly string _pathSource = s_isLinux ? "/Source" : @"C:\Source";
|
||||
private readonly string _pathDestination = s_isLinux ? "/Destination" : @"C:\Destination";
|
||||
private readonly char _dirSeparator = s_isLinux ? '/' : '\\';
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FileProviderServiceTests"/> class.
|
||||
@@ -156,10 +154,10 @@ public class FileProviderServiceTests
|
||||
{
|
||||
// Arrange
|
||||
FileSystemPathId path = _fileSystemPathIdFixture.CreateFileSystemPathId();
|
||||
string[] files = s_isLinux
|
||||
string[] files = s_isLinux
|
||||
? ["/C.txt", "/A.txt", "/B.txt"]
|
||||
: [@"C:\C.txt", @"C:\A.txt", @"C:\B.txt"];
|
||||
string[] expectedFiles = s_isLinux
|
||||
string[] expectedFiles = s_isLinux
|
||||
? ["/A.txt", "/B.txt", "/C.txt"]
|
||||
: [@"C:\A.txt", @"C:\B.txt", @"C:\C.txt"];
|
||||
_mockFileSystemPermissionsService.CanAccessPath(path, FileAccessMode.ListDirectory).Returns(true);
|
||||
@@ -506,7 +504,7 @@ public class FileProviderServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.FileNotFound);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.FileNotFound);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -532,7 +530,7 @@ public class FileProviderServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.FileAlreadyExists);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.FileAlreadyExists);
|
||||
_mockFileSystem.File.DidNotReceive().Copy(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<bool>());
|
||||
}
|
||||
|
||||
@@ -576,7 +574,7 @@ public class FileProviderServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.FileCopyError);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.FileCopyError);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -604,7 +602,8 @@ public class FileProviderServiceTests
|
||||
// Simulate the behavior of CreateUniqueFilePath
|
||||
int copyNumber = 1;
|
||||
_mockFileSystem.File.Exists(Arg.Any<string>())
|
||||
.Returns(x => {
|
||||
.Returns(x =>
|
||||
{
|
||||
string path = x.Arg<string>();
|
||||
if (path == expectedNewFilePath)
|
||||
return false;
|
||||
@@ -638,7 +637,7 @@ public class FileProviderServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.FileNotFound);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.FileNotFound);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -706,7 +705,7 @@ public class FileProviderServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.FileAlreadyExists);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.FileAlreadyExists);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -730,7 +729,7 @@ public class FileProviderServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.FileMoveError);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.FileMoveError);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -829,7 +828,7 @@ public class FileProviderServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.CannotNavigateUp);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.CannotNavigateUp);
|
||||
_mockFileSystem.File.DidNotReceive().Move(Arg.Any<string>(), Arg.Any<string>());
|
||||
}
|
||||
|
||||
@@ -853,7 +852,7 @@ public class FileProviderServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
_mockFileSystem.File.DidNotReceive().Move(Arg.Any<string>(), Arg.Any<string>());
|
||||
}
|
||||
|
||||
@@ -867,7 +866,7 @@ public class FileProviderServiceTests
|
||||
string newName = "NewName.txt";
|
||||
string parentPath = s_isLinux ? "/" : @"C:\";
|
||||
string newPath = s_isLinux ? "/NewName.txt" : @"C:\NewName.txt";
|
||||
|
||||
|
||||
IFileInfo fileInfo = Substitute.For<IFileInfo>();
|
||||
fileInfo.DirectoryName.Returns(parentPath);
|
||||
_mockFileSystem.FileInfo.New(path.Path).Returns(fileInfo);
|
||||
+28
-28
@@ -4,13 +4,13 @@ using FluentAssertions;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Entities.Fixtures;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects.Fixtures;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Entities.Fixtures;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects.Fixtures;
|
||||
using NSubstitute;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="FileService"/> class.
|
||||
@@ -35,7 +35,7 @@ public class FileServiceTests
|
||||
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture;
|
||||
private readonly FileFixture _fileFixture;
|
||||
private static readonly bool s_isLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
|
||||
private readonly string _pathTestDir= s_isLinux ? "/TestDir" : @"C:\TestDir";
|
||||
private readonly string _pathTestDir = s_isLinux ? "/TestDir" : @"C:\TestDir";
|
||||
private readonly string _pathTestDirFile1 = s_isLinux ? "/TestDir/File1.txt" : @"C:\TestDir\File1.txt";
|
||||
private readonly string _pathTestDirFile2 = s_isLinux ? "/TestDir/File2.txt" : @"C:\TestDir\File2.txt";
|
||||
private readonly string _pathTestDirInaccessible = s_isLinux ? "/TestDir/InaccessibleFile.txt" : @"C:\TestDir\InaccessibleFile.txt";
|
||||
@@ -112,7 +112,7 @@ public class FileServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -380,7 +380,7 @@ public class FileServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.FileNotFound);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.FileNotFound);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -449,7 +449,7 @@ public class FileServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -460,13 +460,13 @@ public class FileServiceTests
|
||||
string invalidDestinationPath = string.Empty;
|
||||
bool overrideExisting = true;
|
||||
_mockPlatformContext.PathStrategy.PathSeparator.Returns(_dirSeparator);
|
||||
|
||||
|
||||
// Act
|
||||
ErrorOr<File> result = _sut.CopyFile(sourcePath, invalidDestinationPath, overrideExisting);
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -513,7 +513,7 @@ public class FileServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.FileNotFound);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.FileNotFound);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -614,7 +614,7 @@ public class FileServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.FileNotFound);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.FileNotFound);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -687,7 +687,7 @@ public class FileServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -705,7 +705,7 @@ public class FileServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -754,7 +754,7 @@ public class FileServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.FileNotFound);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.FileNotFound);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -875,7 +875,7 @@ public class FileServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.FileAlreadyExists);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.FileAlreadyExists);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -946,7 +946,7 @@ public class FileServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -996,7 +996,7 @@ public class FileServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.FileAlreadyExists);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.FileAlreadyExists);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -1055,17 +1055,17 @@ public class FileServiceTests
|
||||
// Arrange
|
||||
string path = _pathSourceOldFile;
|
||||
string newName = "newfile.txt";
|
||||
|
||||
|
||||
_mockPlatformContext.PathStrategy.PathSeparator.Returns(_dirSeparator);
|
||||
_mockPlatformContext.PathStrategy.CombinePath(Arg.Any<FileSystemPathId>(), newName)
|
||||
.Returns(Errors.FileManagement.InvalidPath);
|
||||
.Returns(Errors.FileSystemManagement.InvalidPath);
|
||||
|
||||
// Act
|
||||
ErrorOr<File> result = _sut.RenameFile(path, newName);
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -1098,14 +1098,14 @@ public class FileServiceTests
|
||||
string newName = "newfile.txt";
|
||||
|
||||
_mockPlatformContext.PathStrategy.CombinePath(Arg.Any<FileSystemPathId>(), newName)
|
||||
.Returns(Errors.FileManagement.InvalidPath);
|
||||
.Returns(Errors.FileSystemManagement.InvalidPath);
|
||||
|
||||
// Act
|
||||
ErrorOr<File> result = _sut.RenameFile(pathId, newName);
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -1158,7 +1158,7 @@ public class FileServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
+6
-6
@@ -4,11 +4,11 @@ using FluentAssertions;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Contracts.Enums.PhotoLibrary;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Entities.Fixtures;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects.Fixtures;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Entities.Fixtures;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects.Fixtures;
|
||||
using NSubstitute;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -19,7 +19,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="FileTypeService"/> class.
|
||||
+1
-1
@@ -11,7 +11,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Services.Fixtures;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Services.Fixtures;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="ImageType"/> enum.
|
||||
+22
-22
@@ -2,18 +2,18 @@
|
||||
using ErrorOr;
|
||||
using FluentAssertions;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects.Fixtures;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects.Fixtures;
|
||||
using NSubstitute;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="PathService"/> class.
|
||||
@@ -226,7 +226,7 @@ public class PathServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
_mockPathStrategy.DidNotReceive().CombinePath(Arg.Any<FileSystemPathId>(), Arg.Any<string>());
|
||||
}
|
||||
|
||||
@@ -237,14 +237,14 @@ public class PathServiceTests
|
||||
string path = @"C:\BaseDir";
|
||||
string name = "Invalid*Name";
|
||||
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(path);
|
||||
_mockPathStrategy.CombinePath(pathId, name).Returns(Errors.FileManagement.InvalidPath);
|
||||
_mockPathStrategy.CombinePath(pathId, name).Returns(Errors.FileSystemManagement.InvalidPath);
|
||||
|
||||
// Act
|
||||
ErrorOr<string> result = _sut.CombinePath(path, name);
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
_mockPathStrategy.Received(1).CombinePath(Arg.Is<FileSystemPathId>(id => id.Path == path), name);
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ public class PathServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
_mockPathStrategy.DidNotReceive().CombinePath(Arg.Any<FileSystemPathId>(), Arg.Any<string>());
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ public class PathServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
_mockPathStrategy.DidNotReceive().ParsePath(Arg.Any<FileSystemPathId>());
|
||||
}
|
||||
|
||||
@@ -303,14 +303,14 @@ public class PathServiceTests
|
||||
// Arrange
|
||||
string path = @"C:\InvalidPath\*SubDir";
|
||||
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(path);
|
||||
_mockPathStrategy.ParsePath(pathId).Returns(Errors.FileManagement.InvalidPath);
|
||||
_mockPathStrategy.ParsePath(pathId).Returns(Errors.FileSystemManagement.InvalidPath);
|
||||
|
||||
// Act
|
||||
ErrorOr<IEnumerable<PathSegment>> result = _sut.ParsePath(path);
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
_mockPathStrategy.Received(1).ParsePath(Arg.Is<FileSystemPathId>(id => id.Path == path));
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ public class PathServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
_mockPathStrategy.DidNotReceive().ParsePath(Arg.Any<FileSystemPathId>());
|
||||
}
|
||||
|
||||
@@ -376,7 +376,7 @@ public class PathServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
_mockPathStrategy.DidNotReceive().GoUpOneLevel(Arg.Any<FileSystemPathId>());
|
||||
}
|
||||
|
||||
@@ -386,14 +386,14 @@ public class PathServiceTests
|
||||
// Arrange
|
||||
string path = @"C:\InvalidPath\*SubDir";
|
||||
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(path);
|
||||
_mockPathStrategy.GoUpOneLevel(pathId).Returns(Errors.FileManagement.InvalidPath);
|
||||
_mockPathStrategy.GoUpOneLevel(pathId).Returns(Errors.FileSystemManagement.InvalidPath);
|
||||
|
||||
// Act
|
||||
ErrorOr<IEnumerable<PathSegment>> result = _sut.GoUpOneLevel(path);
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
_mockPathStrategy.Received(1).GoUpOneLevel(Arg.Is<FileSystemPathId>(id => id.Path == path));
|
||||
}
|
||||
|
||||
@@ -408,7 +408,7 @@ public class PathServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
_mockPathStrategy.DidNotReceive().GoUpOneLevel(Arg.Any<FileSystemPathId>());
|
||||
}
|
||||
|
||||
@@ -488,7 +488,7 @@ public class PathServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
_mockPathStrategy.DidNotReceive().GetPathRoot(Arg.Any<FileSystemPathId>());
|
||||
}
|
||||
|
||||
@@ -498,14 +498,14 @@ public class PathServiceTests
|
||||
// Arrange
|
||||
string path = @"C:\InvalidPath\*SubDir";
|
||||
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(path);
|
||||
_mockPathStrategy.GetPathRoot(pathId).Returns(Errors.FileManagement.InvalidPath);
|
||||
_mockPathStrategy.GetPathRoot(pathId).Returns(Errors.FileSystemManagement.InvalidPath);
|
||||
|
||||
// Act
|
||||
ErrorOr<PathSegment> result = _sut.GetPathRoot(path);
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
_mockPathStrategy.Received(1).GetPathRoot(Arg.Is<FileSystemPathId>(id => id.Path == path));
|
||||
}
|
||||
|
||||
@@ -520,7 +520,7 @@ public class PathServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
_mockPathStrategy.DidNotReceive().GetPathRoot(Arg.Any<FileSystemPathId>());
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -3,11 +3,11 @@ using ErrorOr;
|
||||
using FluentAssertions;
|
||||
using Lumina.Contracts.Enums.PhotoLibrary;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Services.Fixtures;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects.Fixtures;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Services.Fixtures;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects.Fixtures;
|
||||
using NSubstitute;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.Formats.Jpeg;
|
||||
@@ -18,7 +18,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="ThumbnailService"/> class.
|
||||
@@ -83,7 +83,7 @@ public class ThumbnailServiceTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentAssertions;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Environment;
|
||||
using NSubstitute;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Strategies.Environment;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Strategies.Environment;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="EnvironmentContext"/> class.
|
||||
+11
-11
@@ -2,9 +2,9 @@
|
||||
using ErrorOr;
|
||||
using FluentAssertions;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects.Fixtures;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects.Fixtures;
|
||||
using NSubstitute;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -12,7 +12,7 @@ using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Strategies.Path;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Strategies.Path;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="UnixPathStrategy"/> class.
|
||||
@@ -128,7 +128,7 @@ public class UnixPathStrategyTests
|
||||
// Arrange
|
||||
string existingPath = "/home/user/existing_file.txt";
|
||||
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(existingPath);
|
||||
|
||||
|
||||
_mockFileSystem.Path.Exists(existingPath).Returns(true);
|
||||
_mockFileSystem.File.Exists(existingPath).Returns(true);
|
||||
|
||||
@@ -283,7 +283,7 @@ public class UnixPathStrategyTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.NameCannotBeEmpty);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.NameCannotBeEmpty);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -298,7 +298,7 @@ public class UnixPathStrategyTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.NameCannotBeEmpty);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.NameCannotBeEmpty);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -376,7 +376,7 @@ public class UnixPathStrategyTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -422,7 +422,7 @@ public class UnixPathStrategyTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.CannotNavigateUp);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.CannotNavigateUp);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -452,7 +452,7 @@ public class UnixPathStrategyTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -549,6 +549,6 @@ public class UnixPathStrategyTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
}
|
||||
+17
-17
@@ -2,9 +2,9 @@
|
||||
using ErrorOr;
|
||||
using FluentAssertions;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects.Fixtures;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects.Fixtures;
|
||||
using NSubstitute;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -12,7 +12,7 @@ using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Strategies.Path;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Strategies.Path;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="WindowsPathStrategy"/> class.
|
||||
@@ -326,7 +326,7 @@ public class WindowsPathStrategyTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.NameCannotBeEmpty);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.NameCannotBeEmpty);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -419,7 +419,7 @@ public class WindowsPathStrategyTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -484,7 +484,7 @@ public class WindowsPathStrategyTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.CannotNavigateUp);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.CannotNavigateUp);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -514,7 +514,7 @@ public class WindowsPathStrategyTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -561,7 +561,7 @@ public class WindowsPathStrategyTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.CannotNavigateUp);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.CannotNavigateUp);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -592,7 +592,7 @@ public class WindowsPathStrategyTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.CannotNavigateUp);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.CannotNavigateUp);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -602,7 +602,7 @@ public class WindowsPathStrategyTests
|
||||
char[] result = _sut.GetInvalidPathCharsForPlatform();
|
||||
|
||||
// Assert
|
||||
result.Should().BeEquivalentTo(['<', '>', '"', '/', '|', '?', '*' ]);
|
||||
result.Should().BeEquivalentTo(['<', '>', '"', '/', '|', '?', '*']);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -667,7 +667,7 @@ public class WindowsPathStrategyTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -695,7 +695,7 @@ public class WindowsPathStrategyTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -709,7 +709,7 @@ public class WindowsPathStrategyTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -723,7 +723,7 @@ public class WindowsPathStrategyTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -737,7 +737,7 @@ public class WindowsPathStrategyTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -765,6 +765,6 @@ public class WindowsPathStrategyTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Strategies.Platform.Fixtures;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Strategies.Platform.Fixtures;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture interface for non existing platform context.
|
||||
+4
-4
@@ -1,15 +1,15 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentAssertions;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Strategies.Platform.Fixtures;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Strategies.Platform.Fixtures;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO.Abstractions;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Strategies.Platform;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Strategies.Platform;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="PlatformContextFactory"/> class.
|
||||
+2
-2
@@ -1,14 +1,14 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentAssertions;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using NSubstitute;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Strategies.Platform;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Strategies.Platform;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="PlatformContextManager"/> class.
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentAssertions;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using NSubstitute;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Strategies.Platform;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.Strategies.Platform;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="WindowsPlatformContext"/> and <see cref="UnixPlatformContext"/> classes.
|
||||
+6
-6
@@ -2,12 +2,12 @@
|
||||
using ErrorOr;
|
||||
using FluentAssertions;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects.Fixtures;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects.Fixtures;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="FileSystemPathId"/> class.
|
||||
@@ -43,14 +43,14 @@ public class FileSystemPathIdTests
|
||||
[InlineData(null)]
|
||||
[InlineData("")]
|
||||
[InlineData(" ")]
|
||||
public void Create_WithInvalidPath_ShouldReturnError(string invalidPath)
|
||||
public void Create_WithInvalidPath_ShouldReturnError(string? invalidPath)
|
||||
{
|
||||
// Act
|
||||
ErrorOr<FileSystemPathId> result = FileSystemPathId.Create(invalidPath);
|
||||
ErrorOr<FileSystemPathId> result = FileSystemPathId.Create(invalidPath!);
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.InvalidPath);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.InvalidPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects.Fixtures;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects.Fixtures;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="FileSystemPathId"/> class.
|
||||
+2
-2
@@ -1,14 +1,14 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects.Fixtures;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects.Fixtures;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="PathSegment"/> class.
|
||||
+2
-2
@@ -2,14 +2,14 @@
|
||||
using Bogus;
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects.Fixtures;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects.Fixtures;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="StreamInfo"/> class.
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Enums.PhotoLibrary;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects.Fixtures;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects.Fixtures;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="Thumbnail"/> class.
|
||||
+6
-6
@@ -2,12 +2,12 @@
|
||||
using ErrorOr;
|
||||
using FluentAssertions;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects.Fixtures;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects.Fixtures;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="PathSegment"/> class.
|
||||
@@ -47,14 +47,14 @@ public class PathSegmentTests
|
||||
[InlineData(null)]
|
||||
[InlineData("")]
|
||||
[InlineData(" ")]
|
||||
public void Create_WithInvalidName_ShouldReturnError(string invalidName)
|
||||
public void Create_WithInvalidName_ShouldReturnError(string? invalidName)
|
||||
{
|
||||
// Act
|
||||
ErrorOr<PathSegment> result = PathSegment.Create(invalidName, true, false);
|
||||
ErrorOr<PathSegment> result = PathSegment.Create(invalidName!, true, false);
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.NameCannotBeEmpty);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.NameCannotBeEmpty);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
+6
-16
@@ -1,25 +1,15 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FluentAssertions;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.Entities.Fixtures;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects.Fixtures;
|
||||
using NSubstitute;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects.Fixtures;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="StreamInfo"/> class.
|
||||
@@ -79,7 +69,7 @@ public class StreamInfoTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.StreamIdCannotBeEmpty);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.StreamIdCannotBeEmpty);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -96,7 +86,7 @@ public class StreamInfoTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.CodecCannotBeEmpty);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.CodecCannotBeEmpty);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -113,7 +103,7 @@ public class StreamInfoTests
|
||||
|
||||
// Assert
|
||||
result.IsError.Should().BeTrue();
|
||||
result.FirstError.Should().Be(Errors.FileManagement.BitrateMustBeAPositiveNumber);
|
||||
result.FirstError.Should().Be(Errors.FileSystemManagement.BitrateMustBeAPositiveNumber);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
+3
-3
@@ -1,15 +1,15 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentAssertions;
|
||||
using Lumina.Contracts.Enums.PhotoLibrary;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects.Fixtures;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects.Fixtures;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileManagementAggregate.ValueObjects;
|
||||
namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.ValueObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="Thumbnail"/> class.
|
||||
@@ -14,13 +14,19 @@
|
||||
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="21.0.29" />
|
||||
<PackageReference Include="AutoFixture.Xunit2" Version="4.18.1" />
|
||||
<PackageReference Include="Bogus" Version="35.6.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.0" />
|
||||
<PackageReference Include="FluentAssertions" Version="6.12.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="FluentAssertions" Version="6.12.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
||||
<PackageReference Include="NSubstitute" Version="5.1.0" />
|
||||
<PackageReference Include="xunit" Version="2.5.3" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
|
||||
<PackageReference Include="xunit" Version="2.9.2" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in new issue
Block a user