Inlines fixtures instantiation.

This commit is contained in:
BinaryAlley committed 2026-08-15 03:19:51 -07:00
1 parent b648e2f054
commit 59e16d645a
147 files changed
+190 -898

No files matched your search

@@ -20,7 +20,7 @@ namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate;
public class FileSystemItemTests
{
private readonly IFixture _fixture;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="FileSystemItemTests"/> class.
@@ -28,7 +28,6 @@ public class FileSystemItemTests
public FileSystemItemTests()
{
_fixture = new Fixture().Customize(new AutoNSubstituteCustomization());
_fileSystemPathIdFixture = new FileSystemPathIdFixture();
}
[Fact]
@@ -31,7 +31,7 @@ public class DirectoryProviderServiceTests
private readonly IFileSystem _mockFileSystem;
private readonly IFileSystemPermissionsService _mockFileSystemPermissionsService;
private readonly DirectoryProviderService _sut;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture = new();
private static readonly bool s_isUnix = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
private readonly string _pathSource = s_isUnix ? "/Source" : @"C:\Source";
private readonly string _pathSourceSubDir = s_isUnix ? "/Source/SubDir" : @"C:\Source\SubDir";
@@ -65,7 +65,6 @@ public class DirectoryProviderServiceTests
_mockFileSystem = Substitute.For<IFileSystem>();
_mockFileSystemPermissionsService = Substitute.For<IFileSystemPermissionsService>();
_sut = new DirectoryProviderService(_mockFileSystem, _mockFileSystemPermissionsService);
_fileSystemPathIdFixture = new();
}
[Fact]
@@ -30,8 +30,8 @@ public class DirectoryServiceTests
private readonly IPlatformContextManager _mockPlatformContextManager;
private readonly IPlatformContext _mockPlatformContext;
private readonly DirectoryService _sut;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture;
private readonly DirectoryFixture _directoryFixture;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture = new();
private readonly DirectoryFixture _directoryFixture = new();
private static readonly bool s_isUnix = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
private readonly string _pathDirTest = s_isUnix ? "/TestDir" : @"C:\TestDir";
private readonly string _pathDirTestSubDir1 = s_isUnix ? "/TestDir/Sub1" : @"C:\TestDir\Sub1";
@@ -47,8 +47,6 @@ public class DirectoryServiceTests
_mockPlatformContext = Substitute.For<IPlatformContext>();
_mockPlatformContextManager.GetCurrentContext().Returns(_mockPlatformContext);
_sut = new DirectoryService(_mockEnvironmentContext, _mockPlatformContextManager);
_fileSystemPathIdFixture = new FileSystemPathIdFixture();
_directoryFixture = new DirectoryFixture();
}
[Fact]
@@ -30,7 +30,7 @@ public class FileProviderServiceTests
private readonly IFileSystem _mockFileSystem;
private readonly IFileSystemPermissionsService _mockFileSystemPermissionsService;
private readonly FileProviderService _sut;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture = new();
private static readonly bool s_isUnix = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
private readonly string _pathVisible1 = s_isUnix ? "/Visible.txt" : @"C:\Visible.txt";
private readonly string _pathHidden1 = s_isUnix ? "/Hidden.txt" : @"C:\Hidden.txt";
@@ -50,7 +50,6 @@ public class FileProviderServiceTests
_mockFileSystem = Substitute.For<IFileSystem>();
_mockFileSystemPermissionsService = Substitute.For<IFileSystemPermissionsService>();
_sut = new FileProviderService(_mockFileSystem, _mockFileSystemPermissionsService);
_fileSystemPathIdFixture = new();
}
[Fact]
@@ -30,8 +30,8 @@ public class FileServiceTests
private readonly IPlatformContextManager _mockPlatformContextManager;
private readonly IPlatformContext _mockPlatformContext;
private readonly FileService _sut;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture;
private readonly FileFixture _fileFixture;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture = new();
private readonly FileFixture _fileFixture = new();
private static readonly bool s_isUnix = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
private readonly string _pathTestDir = s_isUnix ? "/TestDir" : @"C:\TestDir";
private readonly string _pathTestDirFile1 = s_isUnix ? "/TestDir/File1.txt" : @"C:\TestDir\File1.txt";
@@ -57,8 +57,6 @@ public class FileServiceTests
_mockPlatformContext = Substitute.For<IPlatformContext>();
_mockPlatformContextManager.GetCurrentContext().Returns(_mockPlatformContext);
_sut = new FileService(_mockEnvironmentContext, _mockPlatformContextManager);
_fileSystemPathIdFixture = new FileSystemPathIdFixture();
_fileFixture = new FileFixture();
}
[Fact]
@@ -29,8 +29,8 @@ public class FileTypeServiceTests
private MockFileSystem _mockFileSystem = null!;
private readonly IFileSystemPermissionsService _mockFileSystemPermissionsService;
private FileTypeService? sut;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture;
private readonly FileFixture _fileFixture;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture = new();
private readonly FileFixture _fileFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="FileTypeServiceTests"/> class.
@@ -38,8 +38,6 @@ public class FileTypeServiceTests
public FileTypeServiceTests()
{
_mockFileSystemPermissionsService = Substitute.For<IFileSystemPermissionsService>();
_fileSystemPathIdFixture = new FileSystemPathIdFixture();
_fileFixture = new FileFixture();
}
[Fact]
@@ -24,8 +24,8 @@ public class PathServiceTests
private readonly IPlatformContext _mockPlatformContext;
private readonly IPathStrategy _mockPathStrategy;
private readonly PathService _sut;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture;
private readonly PathSegmentFixture _pathSegmentFixture;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture = new();
private readonly PathSegmentFixture _pathSegmentFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="PathServiceTests"/> class.
@@ -38,8 +38,6 @@ public class PathServiceTests
_mockPlatformContext.PathStrategy.Returns(_mockPathStrategy);
_mockPlatformContextManager.GetCurrentContext().Returns(_mockPlatformContext);
_sut = new PathService(_mockPlatformContextManager);
_fileSystemPathIdFixture = new FileSystemPathIdFixture();
_pathSegmentFixture = new PathSegmentFixture();
}
[Fact]
@@ -27,7 +27,7 @@ public class ThumbnailServiceTests
{
private readonly IEnvironmentContext _mockEnvironmentContext;
private readonly ThumbnailService _sut;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="ThumbnailServiceTests"/> class.
@@ -36,7 +36,6 @@ public class ThumbnailServiceTests
{
_mockEnvironmentContext = Substitute.For<IEnvironmentContext>();
_sut = new ThumbnailService(_mockEnvironmentContext);
_fileSystemPathIdFixture = new FileSystemPathIdFixture();
}
[Fact]
@@ -21,8 +21,8 @@ public class UnixPathStrategyTests
{
private readonly IFileSystem _mockFileSystem;
private readonly UnixPathStrategy _sut;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture;
private readonly PathSegmentFixture _pathSegmentFixture;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture = new();
private readonly PathSegmentFixture _pathSegmentFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="UnixPathStrategyTests"/> class.
@@ -31,8 +31,6 @@ public class UnixPathStrategyTests
{
_mockFileSystem = Substitute.For<IFileSystem>();
_sut = new UnixPathStrategy(_mockFileSystem);
_fileSystemPathIdFixture = new FileSystemPathIdFixture();
_pathSegmentFixture = new PathSegmentFixture();
}
[Theory]
@@ -21,8 +21,8 @@ public class WindowsPathStrategyTests
{
private readonly IFileSystem _mockFileSystem;
private readonly WindowsPathStrategy _sut;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture;
private readonly PathSegmentFixture _pathSegmentFixture;
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture = new();
private readonly PathSegmentFixture _pathSegmentFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="WindowsPathStrategyTests"/> class.
@@ -31,8 +31,6 @@ public class WindowsPathStrategyTests
{
_mockFileSystem = Substitute.For<IFileSystem>();
_sut = new WindowsPathStrategy(_mockFileSystem);
_fileSystemPathIdFixture = new FileSystemPathIdFixture();
_pathSegmentFixture = new PathSegmentFixture();
}
[Theory]
@@ -14,15 +14,7 @@ namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.
[ExcludeFromCodeCoverage]
public class FileSystemPathIdTests
{
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture;
/// <summary>
/// Initializes a new instance of the <see cref="FileSystemPathIdTests"/> class.
/// </summary>
public FileSystemPathIdTests()
{
_fileSystemPathIdFixture = new FileSystemPathIdFixture();
}
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture = new();
[Fact]
public void Create_WithValidPath_ShouldReturnFileSystemPathId()
@@ -14,15 +14,7 @@ namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.
[ExcludeFromCodeCoverage]
public class PathSegmentTests
{
private readonly PathSegmentFixture _pathSegmentFixture;
/// <summary>
/// Initializes a new instance of the <see cref="PathSegmentTests"/> class.
/// </summary>
public PathSegmentTests()
{
_pathSegmentFixture = new PathSegmentFixture();
}
private readonly PathSegmentFixture _pathSegmentFixture = new();
[Fact]
public void Create_WithValidInput_ShouldReturnPathSegment()
@@ -15,15 +15,7 @@ namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.
[ExcludeFromCodeCoverage]
public class StreamInfoTests
{
private readonly StreamInfoFixture _streamInfoFixture;
/// <summary>
/// Initializes a new instance of the <see cref="StreamInfoTests"/> class.
/// </summary>
public StreamInfoTests()
{
_streamInfoFixture = new StreamInfoFixture();
}
private readonly StreamInfoFixture _streamInfoFixture = new();
[Fact]
public void Create_WithValidInput_ShouldReturnStreamInfo()
@@ -16,15 +16,7 @@ namespace Lumina.Domain.UnitTests.Core.Aggregates.FileSystemManagementAggregate.
[ExcludeFromCodeCoverage]
public class ThumbnailTests
{
private readonly ThumbnailFixture _thumbnailFixture;
/// <summary>
/// Initializes a new instance of the <see cref="ThumbnailTests"/> class.
/// </summary>
public ThumbnailTests()
{
_thumbnailFixture = new ThumbnailFixture();
}
private readonly ThumbnailFixture _thumbnailFixture = new();
[Fact]
public void Constructor_WhenCalled_ShouldSetPropertiesCorrectly()