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.
97 lines
2.5 KiB
97 lines
2.5 KiB
1 year ago
|
using System.Diagnostics.CodeAnalysis;
|
||
|
using Recyclarr.Config.Parsing;
|
||
|
using Recyclarr.Config.Parsing.PostProcessing.ConfigMerging;
|
||
|
|
||
|
namespace Recyclarr.Tests.Config.Parsing.PostProcessing.ConfigMerging;
|
||
|
|
||
|
[TestFixture]
|
||
|
public class MergeMediaNamingRadarrTest
|
||
|
{
|
||
|
[Test]
|
||
|
public void Empty_right_to_non_empty_left()
|
||
|
{
|
||
|
var leftConfig = new RadarrConfigYaml
|
||
|
{
|
||
|
MediaNaming = new RadarrMediaNamingConfigYaml
|
||
|
{
|
||
|
Folder = "folder1",
|
||
|
Movie = new RadarrMovieNamingConfigYaml
|
||
|
{
|
||
|
Rename = false,
|
||
1 year ago
|
Standard = "format1"
|
||
1 year ago
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
var rightConfig = new RadarrConfigYaml();
|
||
|
|
||
|
var sut = new RadarrConfigMerger();
|
||
|
|
||
|
var result = sut.Merge(leftConfig, rightConfig);
|
||
|
|
||
|
result.Should().BeEquivalentTo(leftConfig);
|
||
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void Non_empty_right_to_empty_left()
|
||
|
{
|
||
|
var leftConfig = new RadarrConfigYaml();
|
||
|
|
||
|
var rightConfig = new RadarrConfigYaml
|
||
|
{
|
||
|
MediaNaming = new RadarrMediaNamingConfigYaml
|
||
|
{
|
||
|
Folder = "folder1",
|
||
|
Movie = new RadarrMovieNamingConfigYaml
|
||
|
{
|
||
|
Rename = false,
|
||
1 year ago
|
Standard = "format1"
|
||
1 year ago
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
var sut = new RadarrConfigMerger();
|
||
|
|
||
|
var result = sut.Merge(leftConfig, rightConfig);
|
||
|
|
||
|
result.Should().BeEquivalentTo(rightConfig);
|
||
|
}
|
||
|
|
||
|
[Test]
|
||
|
[SuppressMessage("Reliability", "CA2000:Dispose objects before losing scope")]
|
||
|
public void Non_empty_right_to_non_empty_left()
|
||
|
{
|
||
|
var leftConfig = new RadarrConfigYaml
|
||
|
{
|
||
|
MediaNaming = new RadarrMediaNamingConfigYaml
|
||
|
{
|
||
|
Folder = "folder1",
|
||
|
Movie = new RadarrMovieNamingConfigYaml
|
||
|
{
|
||
|
Rename = false,
|
||
1 year ago
|
Standard = "format1"
|
||
1 year ago
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
var rightConfig = new RadarrConfigYaml
|
||
|
{
|
||
|
MediaNaming = new RadarrMediaNamingConfigYaml
|
||
|
{
|
||
|
Folder = "folder2",
|
||
|
Movie = new RadarrMovieNamingConfigYaml
|
||
|
{
|
||
|
Rename = false,
|
||
1 year ago
|
Standard = "format2"
|
||
1 year ago
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
var sut = new RadarrConfigMerger();
|
||
|
|
||
|
var result = sut.Merge(leftConfig, rightConfig);
|
||
|
|
||
|
result.Should().BeEquivalentTo(rightConfig);
|
||
|
}
|
||
|
}
|