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.
65 lines
1.4 KiB
65 lines
1.4 KiB
1 year ago
|
using Recyclarr.Config.Parsing;
|
||
|
using Recyclarr.Config.Parsing.PostProcessing.ConfigMerging;
|
||
|
|
||
|
namespace Recyclarr.Tests.Config.Parsing.PostProcessing.ConfigMerging;
|
||
|
|
||
|
[TestFixture]
|
||
|
public class MergeApiKeyTest
|
||
|
{
|
||
|
[Test]
|
||
|
public void Empty_right_to_non_empty_left()
|
||
|
{
|
||
|
var leftConfig = new SonarrConfigYaml
|
||
|
{
|
||
|
ApiKey = "a"
|
||
|
};
|
||
|
|
||
|
var rightConfig = new SonarrConfigYaml();
|
||
|
|
||
|
var sut = new SonarrConfigMerger();
|
||
|
|
||
|
var result = sut.Merge(leftConfig, rightConfig);
|
||
|
|
||
|
result.Should().BeEquivalentTo(leftConfig);
|
||
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void Non_empty_right_to_empty_left()
|
||
|
{
|
||
|
var leftConfig = new SonarrConfigYaml();
|
||
|
|
||
|
// API Key should not be merged!
|
||
|
var rightConfig = new SonarrConfigYaml
|
||
|
{
|
||
|
ApiKey = "b"
|
||
|
};
|
||
|
|
||
|
var sut = new SonarrConfigMerger();
|
||
|
|
||
|
var result = sut.Merge(leftConfig, rightConfig);
|
||
|
|
||
|
result.Should().BeEquivalentTo(leftConfig);
|
||
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void Non_empty_right_to_non_empty_left()
|
||
|
{
|
||
|
var leftConfig = new SonarrConfigYaml
|
||
|
{
|
||
|
ApiKey = "a"
|
||
|
};
|
||
|
|
||
|
// API Key should not be merged!
|
||
|
var rightConfig = new SonarrConfigYaml
|
||
|
{
|
||
|
ApiKey = "b"
|
||
|
};
|
||
|
|
||
|
var sut = new SonarrConfigMerger();
|
||
|
|
||
|
var result = sut.Merge(leftConfig, rightConfig);
|
||
|
|
||
|
result.Should().BeEquivalentTo(leftConfig);
|
||
|
}
|
||
|
}
|