|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
using System.IO.Abstractions.TestingHelpers;
|
|
|
|
|
using AutoFixture.NUnit3;
|
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using NSubstitute;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using Recyclarr.Migration.Steps;
|
|
|
|
|
using TestLibrary;
|
|
|
|
@ -12,8 +13,6 @@ namespace Recyclarr.Tests.Migration.Steps;
|
|
|
|
|
[Parallelizable(ParallelScope.All)]
|
|
|
|
|
public class MigrateTrashUpdaterAppDataDirTest
|
|
|
|
|
{
|
|
|
|
|
private const string BasePath = "base_path";
|
|
|
|
|
|
|
|
|
|
[Test, AutoMockData]
|
|
|
|
|
public void Migration_check_returns_true_if_trash_updater_dir_exists(
|
|
|
|
|
[Frozen(Matching.ImplementedInterfaces)] MockFileSystem fs,
|
|
|
|
@ -33,12 +32,13 @@ public class MigrateTrashUpdaterAppDataDirTest
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test, AutoMockData]
|
|
|
|
|
public void Migration_throws_if_recyclarr_dir_already_exists(
|
|
|
|
|
public void Migration_throws_if_recyclarr_yml_already_exists(
|
|
|
|
|
[Frozen(Matching.ImplementedInterfaces)] MockFileSystem fs,
|
|
|
|
|
[Frozen(Matching.ImplementedInterfaces)] TestAppPaths paths,
|
|
|
|
|
MigrateTrashUpdaterAppDataDir sut)
|
|
|
|
|
{
|
|
|
|
|
fs.AddDirectory(Path.Combine(BasePath, "trash-updater"));
|
|
|
|
|
fs.AddDirectory(Path.Combine(BasePath, "recyclarr"));
|
|
|
|
|
fs.AddFileNoData($"{paths.BasePath}/trash-updater/recyclarr.yml");
|
|
|
|
|
fs.AddFileNoData($"{paths.BasePath}/recyclarr/recyclarr.yml");
|
|
|
|
|
|
|
|
|
|
var act = () => sut.Execute(null);
|
|
|
|
|
|
|
|
|
@ -67,4 +67,15 @@ public class MigrateTrashUpdaterAppDataDirTest
|
|
|
|
|
FileUtils.NormalizePath($"/{paths.BasePath}/recyclarr/recyclarr.yml"),
|
|
|
|
|
FileUtils.NormalizePath($"/{paths.BasePath}/recyclarr/cache/sonarr/test.txt"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test, AutoMockData]
|
|
|
|
|
public void No_exception_if_source_files_do_not_exist(
|
|
|
|
|
[Frozen(Matching.ImplementedInterfaces)] MockFileSystem fs,
|
|
|
|
|
[Frozen(Matching.ImplementedInterfaces)] TestAppPaths paths,
|
|
|
|
|
MigrateTrashUpdaterAppDataDir sut)
|
|
|
|
|
{
|
|
|
|
|
var act = () => sut.Execute(null);
|
|
|
|
|
|
|
|
|
|
act.Should().NotThrow();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|