The Trash sonarr guide was restructured so that optionals were in a dedicated release profile that had no non-optional terms in it. Logic was only checking if a profile had non-optional terms in it, and if not, it got tossed out. Logic now also checks to make sure there are no optional terms as well.pull/47/head
parent
546bd3bf5e
commit
cbdd8bc469
@ -0,0 +1,123 @@
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using TrashLib.Sonarr.ReleaseProfile;
|
||||
|
||||
namespace TrashLib.Tests.Sonarr.ReleaseProfile;
|
||||
|
||||
[TestFixture]
|
||||
[Parallelizable(ParallelScope.All)]
|
||||
public class UtilsTest
|
||||
{
|
||||
[Test]
|
||||
public void Profile_with_only_ignored_should_not_be_filtered_out()
|
||||
{
|
||||
var profileData = new ProfileData {Ignored = new List<string> {"term"}};
|
||||
var data = new Dictionary<string, ProfileData> {{"actualData", profileData}};
|
||||
|
||||
var filteredData = Utils.FilterProfiles(data);
|
||||
|
||||
filteredData.Should().BeEquivalentTo(data);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Profile_with_only_required_should_not_be_filtered_out()
|
||||
{
|
||||
var profileData = new ProfileData {Required = new List<string> {"term"}};
|
||||
var data = new Dictionary<string, ProfileData> {{"actualData", profileData}};
|
||||
|
||||
var filteredData = Utils.FilterProfiles(data);
|
||||
|
||||
filteredData.Should().BeEquivalentTo(data);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Profile_with_only_preferred_should_not_be_filtered_out()
|
||||
{
|
||||
var profileData = new ProfileData
|
||||
{
|
||||
Preferred = new Dictionary<int, List<string>>
|
||||
{
|
||||
{100, new List<string> {"term"}}
|
||||
}
|
||||
};
|
||||
|
||||
var data = new Dictionary<string, ProfileData> {{"actualData", profileData}};
|
||||
|
||||
var filteredData = Utils.FilterProfiles(data);
|
||||
|
||||
filteredData.Should().BeEquivalentTo(data);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Profile_with_only_optional_ignored_should_not_be_filtered_out()
|
||||
{
|
||||
var profileData = new ProfileData
|
||||
{
|
||||
Optional = new ProfileDataOptional
|
||||
{
|
||||
Ignored = new List<string> {"term"}
|
||||
}
|
||||
};
|
||||
|
||||
var data = new Dictionary<string, ProfileData> {{"actualData", profileData}};
|
||||
|
||||
var filteredData = Utils.FilterProfiles(data);
|
||||
|
||||
filteredData.Should().BeEquivalentTo(data);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Profile_with_only_optional_required_should_not_be_filtered_out()
|
||||
{
|
||||
var profileData = new ProfileData
|
||||
{
|
||||
Optional = new ProfileDataOptional
|
||||
{
|
||||
Required = new List<string> {"required1"}
|
||||
}
|
||||
};
|
||||
|
||||
var data = new Dictionary<string, ProfileData>
|
||||
{
|
||||
{"actualData", profileData}
|
||||
};
|
||||
|
||||
var filteredData = Utils.FilterProfiles(data);
|
||||
|
||||
filteredData.Should().BeEquivalentTo(data);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Profile_with_only_optional_preferred_should_not_be_filtered_out()
|
||||
{
|
||||
var profileData = new ProfileData
|
||||
{
|
||||
Optional = new ProfileDataOptional
|
||||
{
|
||||
Preferred = new Dictionary<int, List<string>>
|
||||
{
|
||||
{100, new List<string> {"term"}}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var data = new Dictionary<string, ProfileData> {{"actualData", profileData}};
|
||||
|
||||
var filteredData = Utils.FilterProfiles(data);
|
||||
|
||||
filteredData.Should().BeEquivalentTo(data);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Empty_profiles_should_be_filtered_out()
|
||||
{
|
||||
var data = new Dictionary<string, ProfileData>
|
||||
{
|
||||
{"emptyData", new ProfileData()}
|
||||
};
|
||||
|
||||
var filteredData = Utils.FilterProfiles(data);
|
||||
|
||||
filteredData.Should().NotContainKey("emptyData");
|
||||
}
|
||||
}
|
Loading…
Reference in new issue