mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 05:11:10 +00:00
Merge branch 'bugfix/fix-path-sanitization' into feature/add-artwork-provider-and-metadata-aggregation
This commit is contained in:
commit
deada87e56
12 files changed
+442
-45
No files matched your search
@@ -1,6 +1,8 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.Infrastructure.Models.DTO.Themes;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Infrastructure.Common.Models.DTO.Configuration;
|
||||
using Lumina.Infrastructure.Core.Themes;
|
||||
using Lumina.Infrastructure.Fixtures.Common.Models.DTO.Configuration;
|
||||
@@ -55,26 +57,6 @@ public class ThemeServiceTests : IDisposable
|
||||
_sut = CreateSut(_options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cleans up the temporary storage used by the tests.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(_testRootPath))
|
||||
Directory.Delete(_testRootPath, recursive: true);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
// best effort cleanup of the per-test temp directory
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
// best effort cleanup of the per-test temp directory
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MaxArchiveBytes_WhenConfigured_ShouldReturnConfiguredValue()
|
||||
{
|
||||
@@ -1151,6 +1133,26 @@ public class ThemeServiceTests : IDisposable
|
||||
Assert.False(_sut.HasThemePack("bundled-theme"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cleans up the temporary storage used by the tests.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(_testRootPath))
|
||||
Directory.Delete(_testRootPath, recursive: true);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
// best effort cleanup of the per-test temp directory
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
// best effort cleanup of the per-test temp directory
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a valid theme pack that declares the default, home and library templates and their files.
|
||||
/// </summary>
|
||||
@@ -1207,6 +1209,9 @@ public class ThemeServiceTests : IDisposable
|
||||
private static ThemeService CreateSut(ThemeEngineOptionsDto options)
|
||||
{
|
||||
ILogger<ThemeService> logger = Substitute.For<ILogger<ThemeService>>();
|
||||
return new ThemeService(Options.Create(options), logger);
|
||||
IPathService pathService = Substitute.For<IPathService>();
|
||||
pathService.SanitizeSegment(Arg.Any<string>())
|
||||
.Returns(callInfo => PathSegment.Create(callInfo.Arg<string>(), isDirectory: true, isDrive: false));
|
||||
return new ThemeService(Options.Create(options), logger, pathService);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user