You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
1.9 KiB
77 lines
1.9 KiB
2 years ago
|
using Recyclarr.Cli.Pipelines.CustomFormat.PipelinePhases;
|
||
1 year ago
|
using Recyclarr.Config.Models;
|
||
1 year ago
|
using Recyclarr.Tests.TestLibrary;
|
||
1 year ago
|
using Recyclarr.TrashGuide.CustomFormat;
|
||
2 years ago
|
|
||
2 years ago
|
namespace Recyclarr.Cli.Tests.Pipelines.CustomFormat.PipelinePhases;
|
||
2 years ago
|
|
||
|
[TestFixture]
|
||
|
public class CustomFormatConfigPhaseTest
|
||
|
{
|
||
|
[Test, AutoMockData]
|
||
|
public void Return_configs_that_exist_in_guide(
|
||
|
[Frozen] ICustomFormatGuideService guide,
|
||
|
CustomFormatConfigPhase sut)
|
||
|
{
|
||
|
guide.GetCustomFormatData(default!).ReturnsForAnyArgs(new[]
|
||
|
{
|
||
|
NewCf.Data("one", "cf1"),
|
||
|
NewCf.Data("two", "cf2")
|
||
|
});
|
||
|
|
||
2 years ago
|
var config = NewConfig.Radarr() with
|
||
2 years ago
|
{
|
||
|
CustomFormats = new List<CustomFormatConfig>
|
||
|
{
|
||
|
new()
|
||
|
{
|
||
|
TrashIds = new List<string>
|
||
|
{
|
||
|
"cf1",
|
||
|
"cf2"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
var result = sut.Execute(config);
|
||
|
|
||
|
result.Should().BeEquivalentTo(new[]
|
||
|
{
|
||
|
NewCf.Data("one", "cf1"),
|
||
|
NewCf.Data("two", "cf2")
|
||
|
});
|
||
|
}
|
||
|
|
||
|
[Test, AutoMockData]
|
||
|
public void Skip_configs_that_do_not_exist_in_guide(
|
||
|
[Frozen] ICustomFormatGuideService guide,
|
||
|
CustomFormatConfigPhase sut)
|
||
|
{
|
||
|
guide.GetCustomFormatData(default!).ReturnsForAnyArgs(new[]
|
||
|
{
|
||
|
NewCf.Data("", "cf4")
|
||
|
});
|
||
|
|
||
2 years ago
|
var config = NewConfig.Radarr() with
|
||
2 years ago
|
{
|
||
|
CustomFormats = new List<CustomFormatConfig>
|
||
|
{
|
||
|
new()
|
||
|
{
|
||
|
TrashIds = new List<string>
|
||
|
{
|
||
|
"cf1",
|
||
|
"cf2",
|
||
|
"cf3"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
var result = sut.Execute(config);
|
||
|
|
||
|
result.Should().BeEmpty();
|
||
|
}
|
||
|
}
|