style: Use collection expressions across whole solution

pull/311/head
Robert Dailey 5 months ago
parent b0c1423ee4
commit 96c3cb368e

@ -28,7 +28,7 @@ public class ConfigCreateCommand(ILogger log, IConfigCreationProcessor processor
"One or more template configuration files to create. Use `config list templates` to get a list of " + "One or more template configuration files to create. Use `config list templates` to get a list of " +
"names accepted here.")] "names accepted here.")]
[UsedImplicitly(ImplicitUseKindFlags.Assign)] [UsedImplicitly(ImplicitUseKindFlags.Assign)]
public string[] TemplatesOption { get; init; } = Array.Empty<string>(); public string[] TemplatesOption { get; init; } = [];
public IReadOnlyCollection<string> Templates => TemplatesOption; public IReadOnlyCollection<string> Templates => TemplatesOption;
[CommandOption("-f|--force")] [CommandOption("-f|--force")]

@ -27,7 +27,7 @@ public class DeleteCustomFormatsCommand(
[CommandArgument(0, "[cf_names]")] [CommandArgument(0, "[cf_names]")]
[Description("One or more custom format names to delete. Optional only if `--all` is used.")] [Description("One or more custom format names to delete. Optional only if `--all` is used.")]
public string[] CustomFormatNamesOption { get; init; } = Array.Empty<string>(); public string[] CustomFormatNamesOption { get; init; } = [];
public IReadOnlyCollection<string> CustomFormatNames => CustomFormatNamesOption; public IReadOnlyCollection<string> CustomFormatNames => CustomFormatNamesOption;
[CommandOption("-a|--all")] [CommandOption("-a|--all")]

@ -29,7 +29,7 @@ public class SyncCommand(IMigrationExecutor migration, IMultiRepoUpdater repoUpd
[CommandOption("-c|--config")] [CommandOption("-c|--config")]
[Description("One or more YAML configuration files to load & use.")] [Description("One or more YAML configuration files to load & use.")]
[UsedImplicitly(ImplicitUseKindFlags.Assign)] [UsedImplicitly(ImplicitUseKindFlags.Assign)]
public string[] ConfigsOption { get; init; } = Array.Empty<string>(); public string[] ConfigsOption { get; init; } = [];
public IReadOnlyCollection<string> Configs => ConfigsOption; public IReadOnlyCollection<string> Configs => ConfigsOption;
[CommandOption("-p|--preview")] [CommandOption("-p|--preview")]
@ -40,7 +40,7 @@ public class SyncCommand(IMigrationExecutor migration, IMultiRepoUpdater repoUpd
[CommandOption("-i|--instance")] [CommandOption("-i|--instance")]
[Description("One or more instance names to sync. If not specified, all instances will be synced.")] [Description("One or more instance names to sync. If not specified, all instances will be synced.")]
[UsedImplicitly(ImplicitUseKindFlags.Assign)] [UsedImplicitly(ImplicitUseKindFlags.Assign)]
public string[] InstancesOption { get; init; } = Array.Empty<string>(); public string[] InstancesOption { get; init; } = [];
public IReadOnlyCollection<string> Instances => InstancesOption; public IReadOnlyCollection<string> Instances => InstancesOption;
} }

@ -9,11 +9,11 @@ namespace Recyclarr.Cli.Migration.Steps;
public class DeleteRepoDirMigrationStep(IAppPaths paths) : IMigrationStep public class DeleteRepoDirMigrationStep(IAppPaths paths) : IMigrationStep
{ {
public string Description => "Delete old repo directory"; public string Description => "Delete old repo directory";
public IReadOnlyCollection<string> Remediation => new[] public IReadOnlyCollection<string> Remediation =>
{ [
$"Ensure Recyclarr has permission to recursively delete {RepoDir}", $"Ensure Recyclarr has permission to recursively delete {RepoDir}",
$"Delete {RepoDir} manually if Recyclarr can't do it" $"Delete {RepoDir} manually if Recyclarr can't do it"
}; ];
public bool Required => false; public bool Required => false;
private IDirectoryInfo RepoDir => paths.AppDataDirectory.SubDirectory("repo"); private IDirectoryInfo RepoDir => paths.AppDataDirectory.SubDirectory("repo");

@ -13,11 +13,11 @@ public class MoveOsxAppDataDotnet8(
: IMigrationStep : IMigrationStep
{ {
public string Description => "Migrate OSX app data to 'Library/Application Support'"; public string Description => "Migrate OSX app data to 'Library/Application Support'";
public IReadOnlyCollection<string> Remediation => new[] public IReadOnlyCollection<string> Remediation =>
{ [
$"Ensure Recyclarr has permission to move {OldAppDataDir} to {NewAppDataDir} and try again", $"Ensure Recyclarr has permission to move {OldAppDataDir} to {NewAppDataDir} and try again",
$"Move {OldAppDataDir} to {NewAppDataDir} manually if Recyclarr can't do it" $"Move {OldAppDataDir} to {NewAppDataDir} manually if Recyclarr can't do it"
}; ];
public bool Required => true; public bool Required => true;

@ -9,11 +9,11 @@ namespace Recyclarr.Cli.Pipelines.CustomFormat;
public class CustomFormatPipelineContext : IPipelineContext public class CustomFormatPipelineContext : IPipelineContext
{ {
public string PipelineDescription => "Custom Format"; public string PipelineDescription => "Custom Format";
public IReadOnlyCollection<SupportedServices> SupportedServiceTypes { get; } = new[] public IReadOnlyCollection<SupportedServices> SupportedServiceTypes { get; } =
{ [
SupportedServices.Sonarr, SupportedServices.Sonarr,
SupportedServices.Radarr SupportedServices.Radarr
}; ];
public IList<CustomFormatData> ConfigOutput { get; init; } = []; public IList<CustomFormatData> ConfigOutput { get; init; } = [];
public IList<CustomFormatData> ApiFetchOutput { get; init; } = []; public IList<CustomFormatData> ApiFetchOutput { get; init; } = [];

@ -8,11 +8,11 @@ namespace Recyclarr.Cli.Pipelines.MediaNaming;
public class MediaNamingPipelineContext : IPipelineContext public class MediaNamingPipelineContext : IPipelineContext
{ {
public string PipelineDescription => "Media Naming"; public string PipelineDescription => "Media Naming";
public IReadOnlyCollection<SupportedServices> SupportedServiceTypes { get; } = new[] public IReadOnlyCollection<SupportedServices> SupportedServiceTypes { get; } =
{ [
SupportedServices.Sonarr, SupportedServices.Sonarr,
SupportedServices.Radarr SupportedServices.Radarr
}; ];
public ProcessedNamingConfig ConfigOutput { get; set; } = default!; public ProcessedNamingConfig ConfigOutput { get; set; } = default!;
public MediaNamingDto ApiFetchOutput { get; set; } = default!; public MediaNamingDto ApiFetchOutput { get; set; } = default!;

@ -7,7 +7,7 @@ namespace Recyclarr.Cli.Pipelines.QualityProfile;
public class QualityItemOrganizer public class QualityItemOrganizer
{ {
private readonly List<string> _invalidItemNames = new(); private readonly List<string> _invalidItemNames = [];
public UpdatedQualities OrganizeItems(QualityProfileDto dto, QualityProfileConfig config) public UpdatedQualities OrganizeItems(QualityProfileDto dto, QualityProfileConfig config)
{ {
@ -88,7 +88,7 @@ public class QualityItemOrganizer
if (wantedItems.FindQualityByName(dto.Quality.Name) is null) if (wantedItems.FindQualityByName(dto.Quality.Name) is null)
{ {
// Not in wanted list, so we keep // Not in wanted list, so we keep
return new[] {dto}; return [dto];
} }
} }
// Group // Group
@ -106,15 +106,15 @@ public class QualityItemOrganizer
} }
// If the group is NOT in the wanted list, keep the group and add its children (if they are not wanted) // If the group is NOT in the wanted list, keep the group and add its children (if they are not wanted)
return new[] return
{ [
dto with dto with
{ {
Items = unwantedQualities Items = unwantedQualities
.Select(y => y with {Allowed = false}) .Select(y => y with {Allowed = false})
.ToList() .ToList()
} }
}; ];
} }
return Array.Empty<ProfileItemDto>(); return Array.Empty<ProfileItemDto>();

@ -11,11 +11,11 @@ namespace Recyclarr.Cli.Pipelines.QualityProfile;
public class QualityProfilePipelineContext : IPipelineContext public class QualityProfilePipelineContext : IPipelineContext
{ {
public string PipelineDescription => "Quality Definition"; public string PipelineDescription => "Quality Definition";
public IReadOnlyCollection<SupportedServices> SupportedServiceTypes { get; } = new[] public IReadOnlyCollection<SupportedServices> SupportedServiceTypes { get; } =
{ [
SupportedServices.Sonarr, SupportedServices.Sonarr,
SupportedServices.Radarr SupportedServices.Radarr
}; ];
public IList<ProcessedQualityProfileData> ConfigOutput { get; set; } = default!; public IList<ProcessedQualityProfileData> ConfigOutput { get; set; } = default!;
public QualityProfileServiceData ApiFetchOutput { get; set; } = default!; public QualityProfileServiceData ApiFetchOutput { get; set; } = default!;

@ -11,11 +11,11 @@ namespace Recyclarr.Cli.Pipelines.QualitySize;
public class QualitySizePipelineContext : IPipelineContext public class QualitySizePipelineContext : IPipelineContext
{ {
public string PipelineDescription => "Quality Definition"; public string PipelineDescription => "Quality Definition";
public IReadOnlyCollection<SupportedServices> SupportedServiceTypes { get; } = new[] public IReadOnlyCollection<SupportedServices> SupportedServiceTypes { get; } =
{ [
SupportedServices.Sonarr, SupportedServices.Sonarr,
SupportedServices.Radarr SupportedServices.Radarr
}; ];
public ProcessedQualitySizeData? ConfigOutput { get; set; } public ProcessedQualitySizeData? ConfigOutput { get; set; }
public IList<ServiceQualityDefinitionItem> ApiFetchOutput { get; set; } = default!; public IList<ServiceQualityDefinitionItem> ApiFetchOutput { get; set; } = default!;

@ -158,7 +158,7 @@ public class DeleteCustomFormatsProcessor(
{ {
var configs = configRegistry.FindAndLoadConfigs(new ConfigFilterCriteria var configs = configRegistry.FindAndLoadConfigs(new ConfigFilterCriteria
{ {
Instances = new[] {settings.InstanceName} Instances = [settings.InstanceName]
}); });
switch (configs.Count) switch (configs.Count)

@ -77,7 +77,7 @@ public abstract class ServiceConfigMerger<T> where T : ServiceConfigYaml
.Where(x => x.TrashIds is not null) .Where(x => x.TrashIds is not null)
.SelectMany(x => x is {AssignScoresTo.Count: > 0} .SelectMany(x => x is {AssignScoresTo.Count: > 0}
? x.AssignScoresTo.Select(y => new FlattenedCfs(y.Name, y.Score, x.TrashIds!)) ? x.AssignScoresTo.Select(y => new FlattenedCfs(y.Name, y.Score, x.TrashIds!))
: new[] {new FlattenedCfs(null, null, x.TrashIds!)}) : [new FlattenedCfs(null, null, x.TrashIds!)])
.GroupBy(x => (Name: x.ProfileName, x.Score)) .GroupBy(x => (Name: x.ProfileName, x.Score))
.Select(x => new FlattenedCfs(x.Key.Name, x.Key.Score, x.SelectMany(y => y.TrashIds).ToList())) .Select(x => new FlattenedCfs(x.Key.Name, x.Key.Score, x.SelectMany(y => y.TrashIds).ToList()))
.ToList(); .ToList();

@ -77,15 +77,15 @@ public sealed class GitRepository(ILogger log, IGitPath gitPath, IDirectoryInfo
var args = new List<string> {"clone"}; var args = new List<string> {"clone"};
if (branch is not null) if (branch is not null)
{ {
args.AddRange(new[] {"-b", branch}); args.AddRange(["-b", branch]);
} }
if (depth != 0) if (depth != 0)
{ {
args.AddRange(new[] {"--depth", depth.ToString()}); args.AddRange(["--depth", depth.ToString()]);
} }
args.AddRange(new[] {cloneUrl.ToString(), "."}); args.AddRange([cloneUrl.ToString(), "."]);
await RunGitCmd(token, args); await RunGitCmd(token, args);
} }
} }

@ -11,11 +11,10 @@ internal class BaseCommandSetupIntegrationTest : CliIntegrationFixture
public void Base_command_startup_tasks_are_registered() public void Base_command_startup_tasks_are_registered()
{ {
var registrations = Resolve<IEnumerable<IGlobalSetupTask>>(); var registrations = Resolve<IEnumerable<IGlobalSetupTask>>();
registrations.Select(x => x.GetType()).Should().BeEquivalentTo(new[] registrations.Select(x => x.GetType()).Should().BeEquivalentTo([
{
typeof(JanitorCleanupTask), typeof(JanitorCleanupTask),
typeof(ProgramInformationDisplayTask) typeof(ProgramInformationDisplayTask)
}); ]);
} }
[Test] [Test]

@ -98,22 +98,20 @@ internal class ConfigCreationProcessorIntegrationTest : CliIntegrationFixture
Fs.AddEmptyFile(repo.Path.File("template-file3.yml")); Fs.AddEmptyFile(repo.Path.File("template-file3.yml"));
var settings = Substitute.For<ICreateConfigSettings>(); var settings = Substitute.For<ICreateConfigSettings>();
settings.Templates.Returns(new[] settings.Templates.Returns([
{
"template1", "template1",
"template2", "template2",
// This one shouldn't show up in the results because: // This one shouldn't show up in the results because:
// User specified it, but no template file exists for it. // User specified it, but no template file exists for it.
"template4" "template4"
}); ]);
var sut = Resolve<ConfigCreationProcessor>(); var sut = Resolve<ConfigCreationProcessor>();
sut.Process(settings); sut.Process(settings);
Fs.AllFiles.Should().Contain(new[] Fs.AllFiles.Should().Contain([
{
Paths.ConfigsDirectory.File("template-file1.yml").FullName, Paths.ConfigsDirectory.File("template-file1.yml").FullName,
Paths.ConfigsDirectory.File("template-file2.yml").FullName Paths.ConfigsDirectory.File("template-file2.yml").FullName
}); ]);
} }
} }

@ -41,22 +41,20 @@ internal class TemplateConfigCreatorIntegrationTest : CliIntegrationFixture
Fs.AddEmptyFile(repo.Path.File("template-file3.yml")); Fs.AddEmptyFile(repo.Path.File("template-file3.yml"));
var settings = Substitute.For<ICreateConfigSettings>(); var settings = Substitute.For<ICreateConfigSettings>();
settings.Templates.Returns(new[] settings.Templates.Returns([
{
"template1", "template1",
"template2", "template2",
// This one shouldn't show up in the results because: // This one shouldn't show up in the results because:
// User specified it, but no template file exists for it. // User specified it, but no template file exists for it.
"template4" "template4"
}); ]);
var sut = Resolve<TemplateConfigCreator>(); var sut = Resolve<TemplateConfigCreator>();
sut.Create(settings); sut.Create(settings);
Fs.AllFiles.Should().Contain(new[] Fs.AllFiles.Should().Contain([
{
Paths.ConfigsDirectory.File("template-file1.yml").FullName, Paths.ConfigsDirectory.File("template-file1.yml").FullName,
Paths.ConfigsDirectory.File("template-file2.yml").FullName Paths.ConfigsDirectory.File("template-file2.yml").FullName
}); ]);
} }
} }

@ -31,13 +31,12 @@ public class CustomFormatCacheTest
var cache = CfCache.New(); var cache = CfCache.New();
cache.Update(transactions); cache.Update(transactions);
cache.TrashIdMappings.Should().BeEquivalentTo(new[] cache.TrashIdMappings.Should().BeEquivalentTo([
{
new TrashIdMapping("1", "one", 1), new TrashIdMapping("1", "one", 1),
new TrashIdMapping("2", "two", 2), new TrashIdMapping("2", "two", 2),
new TrashIdMapping("3", "three", 3), new TrashIdMapping("3", "three", 3),
new TrashIdMapping("4", "four", 4) new TrashIdMapping("4", "four", 4)
}); ]);
} }
[Test] [Test]
@ -63,12 +62,11 @@ public class CustomFormatCacheTest
cache.Update(transactions); cache.Update(transactions);
cache.TrashIdMappings.Should().BeEquivalentTo(new[] cache.TrashIdMappings.Should().BeEquivalentTo([
{
new TrashIdMapping("1", "one", 1), new TrashIdMapping("1", "one", 1),
new TrashIdMapping("2", "two", 2), new TrashIdMapping("2", "two", 2),
new TrashIdMapping("4", "four", 4) new TrashIdMapping("4", "four", 4)
}); ]);
} }
[Test] [Test]
@ -89,11 +87,10 @@ public class CustomFormatCacheTest
cache.RemoveStale(serviceCfs); cache.RemoveStale(serviceCfs);
cache.TrashIdMappings.Should().BeEquivalentTo(new[] cache.TrashIdMappings.Should().BeEquivalentTo([
{
new TrashIdMapping("1", "one", 1), new TrashIdMapping("1", "one", 1),
new TrashIdMapping("2", "two", 2) new TrashIdMapping("2", "two", 2)
}); ]);
} }
[Test] [Test]
@ -116,11 +113,10 @@ public class CustomFormatCacheTest
cache.Update(transactions); cache.Update(transactions);
cache.TrashIdMappings.Should().BeEquivalentTo(new[] cache.TrashIdMappings.Should().BeEquivalentTo([
{
new TrashIdMapping("1", "one", 1), new TrashIdMapping("1", "one", 1),
new TrashIdMapping("2", "two", 2) new TrashIdMapping("2", "two", 2)
}); ]);
} }
[Test] [Test]
@ -152,13 +148,12 @@ public class CustomFormatCacheTest
cache.Update(transactions); cache.Update(transactions);
cache.TrashIdMappings.Should().BeEquivalentTo(new[] cache.TrashIdMappings.Should().BeEquivalentTo([
{
new TrashIdMapping("1", "one_new", 1), new TrashIdMapping("1", "one_new", 1),
new TrashIdMapping("2", "two_new", 2), new TrashIdMapping("2", "two_new", 2),
new TrashIdMapping("3", "three_new", 3), new TrashIdMapping("3", "three_new", 3),
new TrashIdMapping("4", "four_new", 4) new TrashIdMapping("4", "four_new", 4)
}); ]);
} }
[Test] [Test]
@ -176,13 +171,12 @@ public class CustomFormatCacheTest
cache.Update(transactions); cache.Update(transactions);
cache.TrashIdMappings.Should().BeEquivalentTo(new[] cache.TrashIdMappings.Should().BeEquivalentTo([
{
new TrashIdMapping("1", "one", 1), new TrashIdMapping("1", "one", 1),
new TrashIdMapping("2", "two", 2), new TrashIdMapping("2", "two", 2),
new TrashIdMapping("3", "three", 3), new TrashIdMapping("3", "three", 3),
new TrashIdMapping("4", "four", 4) new TrashIdMapping("4", "four", 4)
}); ]);
} }
[Test] [Test]
@ -199,12 +193,11 @@ public class CustomFormatCacheTest
cache.Update(transactions); cache.Update(transactions);
cache.TrashIdMappings.Should().BeEquivalentTo(new[] cache.TrashIdMappings.Should().BeEquivalentTo([
{
new TrashIdMapping("1", "one", 1), new TrashIdMapping("1", "one", 1),
new TrashIdMapping("2", "two", 2), new TrashIdMapping("2", "two", 2),
new TrashIdMapping("3", "three", 3), new TrashIdMapping("3", "three", 3),
new TrashIdMapping("4", "four", 4) new TrashIdMapping("4", "four", 4)
}, o => o.WithStrictOrdering()); ], o => o.WithStrictOrdering());
} }
} }

@ -87,7 +87,7 @@ public class MigrationExecutorTest
using var console = new TestConsole(); using var console = new TestConsole();
var step = Substitute.For<IMigrationStep>(); var step = Substitute.For<IMigrationStep>();
var executor = new MigrationExecutor(new[] {step}.AsOrdered(), console); var executor = new MigrationExecutor(new[] {step}.AsOrdered(), console);
var exception = new MigrationException(new ArgumentException(), "a", new[] {"b"}); var exception = new MigrationException(new ArgumentException(), "a", ["b"]);
step.CheckIfNeeded().Returns(true); step.CheckIfNeeded().Returns(true);
step.When(x => x.Execute(null)).Throw(exception); step.When(x => x.Execute(null)).Throw(exception);

@ -12,21 +12,21 @@ public class CustomFormatDataComparerTest
{ {
Name = "EVO (no WEBDL)", Name = "EVO (no WEBDL)",
IncludeCustomFormatWhenRenaming = false, IncludeCustomFormatWhenRenaming = false,
Specifications = new[] Specifications =
{ [
new CustomFormatSpecificationData new CustomFormatSpecificationData
{ {
Name = "EVO", Name = "EVO",
Implementation = "ReleaseTitleSpecification", Implementation = "ReleaseTitleSpecification",
Negate = false, Negate = false,
Required = true, Required = true,
Fields = new[] Fields =
{ [
new CustomFormatFieldData new CustomFormatFieldData
{ {
Value = "\\bEVO(TGX)?\\b" Value = "\\bEVO(TGX)?\\b"
} }
} ]
}, },
new CustomFormatSpecificationData new CustomFormatSpecificationData
{ {
@ -34,13 +34,13 @@ public class CustomFormatDataComparerTest
Implementation = "SourceSpecification", Implementation = "SourceSpecification",
Negate = true, Negate = true,
Required = true, Required = true,
Fields = new[] Fields =
{ [
new CustomFormatFieldData new CustomFormatFieldData
{ {
Value = 7 Value = 7
} }
} ]
}, },
new CustomFormatSpecificationData new CustomFormatSpecificationData
{ {
@ -48,36 +48,36 @@ public class CustomFormatDataComparerTest
Implementation = "SourceSpecification", Implementation = "SourceSpecification",
Negate = true, Negate = true,
Required = true, Required = true,
Fields = new[] Fields =
{ [
new CustomFormatFieldData new CustomFormatFieldData
{ {
Value = 8 Value = 8
} }
} ]
} }
} ]
}; };
var b = new CustomFormatData var b = new CustomFormatData
{ {
Name = "EVO (no WEBDL)", Name = "EVO (no WEBDL)",
IncludeCustomFormatWhenRenaming = false, IncludeCustomFormatWhenRenaming = false,
Specifications = new[] Specifications =
{ [
new CustomFormatSpecificationData new CustomFormatSpecificationData
{ {
Name = "EVO", Name = "EVO",
Implementation = "ReleaseTitleSpecification", Implementation = "ReleaseTitleSpecification",
Negate = false, Negate = false,
Required = true, Required = true,
Fields = new[] Fields =
{ [
new CustomFormatFieldData new CustomFormatFieldData
{ {
Value = "\\bEVO(TGX)?\\b" Value = "\\bEVO(TGX)?\\b"
} }
} ]
}, },
new CustomFormatSpecificationData new CustomFormatSpecificationData
{ {
@ -85,13 +85,13 @@ public class CustomFormatDataComparerTest
Implementation = "SourceSpecification", Implementation = "SourceSpecification",
Negate = true, Negate = true,
Required = true, Required = true,
Fields = new[] Fields =
{ [
new CustomFormatFieldData new CustomFormatFieldData
{ {
Value = 7 Value = 7
} }
} ]
}, },
new CustomFormatSpecificationData new CustomFormatSpecificationData
{ {
@ -99,15 +99,15 @@ public class CustomFormatDataComparerTest
Implementation = "SourceSpecification", Implementation = "SourceSpecification",
Negate = true, Negate = true,
Required = true, Required = true,
Fields = new[] Fields =
{ [
new CustomFormatFieldData new CustomFormatFieldData
{ {
Value = 8 Value = 8
} }
} ]
} }
} ]
}; };
a.Should().BeEquivalentTo(b, o => o.Using(CustomFormatData.Comparer)); a.Should().BeEquivalentTo(b, o => o.Using(CustomFormatData.Comparer));
@ -120,21 +120,21 @@ public class CustomFormatDataComparerTest
{ {
Name = "EVO (no WEBDL)", Name = "EVO (no WEBDL)",
IncludeCustomFormatWhenRenaming = false, IncludeCustomFormatWhenRenaming = false,
Specifications = new[] Specifications =
{ [
new CustomFormatSpecificationData new CustomFormatSpecificationData
{ {
Name = "EVO", Name = "EVO",
Implementation = "ReleaseTitleSpecification", Implementation = "ReleaseTitleSpecification",
Negate = false, Negate = false,
Required = true, Required = true,
Fields = new[] Fields =
{ [
new CustomFormatFieldData new CustomFormatFieldData
{ {
Value = "\\bEVO(TGX)?\\b" Value = "\\bEVO(TGX)?\\b"
} }
} ]
}, },
new CustomFormatSpecificationData new CustomFormatSpecificationData
{ {
@ -142,13 +142,13 @@ public class CustomFormatDataComparerTest
Implementation = "SourceSpecification", Implementation = "SourceSpecification",
Negate = true, Negate = true,
Required = true, Required = true,
Fields = new[] Fields =
{ [
new CustomFormatFieldData new CustomFormatFieldData
{ {
Value = 7 Value = 7
} }
} ]
}, },
new CustomFormatSpecificationData new CustomFormatSpecificationData
{ {
@ -156,36 +156,36 @@ public class CustomFormatDataComparerTest
Implementation = "SourceSpecification", Implementation = "SourceSpecification",
Negate = true, Negate = true,
Required = true, Required = true,
Fields = new[] Fields =
{ [
new CustomFormatFieldData new CustomFormatFieldData
{ {
Value = 8 Value = 8
} }
} ]
} }
} ]
}; };
var b = new CustomFormatData var b = new CustomFormatData
{ {
Name = "EVO (no WEBDL)", Name = "EVO (no WEBDL)",
IncludeCustomFormatWhenRenaming = false, IncludeCustomFormatWhenRenaming = false,
Specifications = new[] Specifications =
{ [
new CustomFormatSpecificationData new CustomFormatSpecificationData
{ {
Name = "EVO", Name = "EVO",
Implementation = "ReleaseTitleSpecification", Implementation = "ReleaseTitleSpecification",
Negate = false, Negate = false,
Required = true, Required = true,
Fields = new[] Fields =
{ [
new CustomFormatFieldData new CustomFormatFieldData
{ {
Value = "\\bEVO(TGX)?\\b" Value = "\\bEVO(TGX)?\\b"
} }
} ]
}, },
new CustomFormatSpecificationData new CustomFormatSpecificationData
{ {
@ -193,13 +193,13 @@ public class CustomFormatDataComparerTest
Implementation = "SourceSpecification", Implementation = "SourceSpecification",
Negate = true, Negate = true,
Required = true, Required = true,
Fields = new[] Fields =
{ [
new CustomFormatFieldData new CustomFormatFieldData
{ {
Value = 10 // this is different Value = 10 // this is different
} }
} ]
}, },
new CustomFormatSpecificationData new CustomFormatSpecificationData
{ {
@ -207,15 +207,15 @@ public class CustomFormatDataComparerTest
Implementation = "SourceSpecification", Implementation = "SourceSpecification",
Negate = true, Negate = true,
Required = true, Required = true,
Fields = new[] Fields =
{ [
new CustomFormatFieldData new CustomFormatFieldData
{ {
Value = 8 Value = 8
} }
} ]
} }
} ]
}; };
var result = CustomFormatData.Comparer.Equals(a, b); var result = CustomFormatData.Comparer.Equals(a, b);
@ -284,23 +284,23 @@ public class CustomFormatDataComparerTest
{ {
Name = "EVO (no WEBDL)", Name = "EVO (no WEBDL)",
IncludeCustomFormatWhenRenaming = false, IncludeCustomFormatWhenRenaming = false,
Specifications = new[] Specifications =
{ [
new CustomFormatSpecificationData(), new CustomFormatSpecificationData(),
new CustomFormatSpecificationData() new CustomFormatSpecificationData()
} ]
}; };
var b = new CustomFormatData var b = new CustomFormatData
{ {
Name = "EVO (no WEBDL)", Name = "EVO (no WEBDL)",
IncludeCustomFormatWhenRenaming = false, IncludeCustomFormatWhenRenaming = false,
Specifications = new[] Specifications =
{ [
new CustomFormatSpecificationData(), new CustomFormatSpecificationData(),
new CustomFormatSpecificationData(), new CustomFormatSpecificationData(),
new CustomFormatSpecificationData() new CustomFormatSpecificationData()
} ]
}; };
var result = CustomFormatData.Comparer.Equals(a, b); var result = CustomFormatData.Comparer.Equals(a, b);
@ -315,21 +315,21 @@ public class CustomFormatDataComparerTest
{ {
Name = "EVO (no WEBDL)", Name = "EVO (no WEBDL)",
IncludeCustomFormatWhenRenaming = false, IncludeCustomFormatWhenRenaming = false,
Specifications = new[] Specifications =
{ [
new CustomFormatSpecificationData new CustomFormatSpecificationData
{ {
Name = "EVO", Name = "EVO",
Implementation = "ReleaseTitleSpecification", Implementation = "ReleaseTitleSpecification",
Negate = false, Negate = false,
Required = true, Required = true,
Fields = new[] Fields =
{ [
new CustomFormatFieldData new CustomFormatFieldData
{ {
Value = "\\bEVO(TGX)?\\b" Value = "\\bEVO(TGX)?\\b"
} }
} ]
}, },
new CustomFormatSpecificationData new CustomFormatSpecificationData
{ {
@ -337,13 +337,13 @@ public class CustomFormatDataComparerTest
Implementation = "SourceSpecification", Implementation = "SourceSpecification",
Negate = true, Negate = true,
Required = true, Required = true,
Fields = new[] Fields =
{ [
new CustomFormatFieldData new CustomFormatFieldData
{ {
Value = 7 Value = 7
} }
} ]
}, },
new CustomFormatSpecificationData new CustomFormatSpecificationData
{ {
@ -351,36 +351,36 @@ public class CustomFormatDataComparerTest
Implementation = "SourceSpecification", Implementation = "SourceSpecification",
Negate = true, Negate = true,
Required = true, Required = true,
Fields = new[] Fields =
{ [
new CustomFormatFieldData new CustomFormatFieldData
{ {
Value = 8 Value = 8
} }
} ]
} }
} ]
}; };
var b = new CustomFormatData var b = new CustomFormatData
{ {
Name = "EVO (no WEBDL)", Name = "EVO (no WEBDL)",
IncludeCustomFormatWhenRenaming = false, IncludeCustomFormatWhenRenaming = false,
Specifications = new[] Specifications =
{ [
new CustomFormatSpecificationData new CustomFormatSpecificationData
{ {
Name = "EVO", Name = "EVO",
Implementation = "ReleaseTitleSpecification", Implementation = "ReleaseTitleSpecification",
Negate = false, Negate = false,
Required = true, Required = true,
Fields = new[] Fields =
{ [
new CustomFormatFieldData new CustomFormatFieldData
{ {
Value = "\\bEVO(TGX)?\\b" Value = "\\bEVO(TGX)?\\b"
} }
} ]
}, },
new CustomFormatSpecificationData new CustomFormatSpecificationData
{ {
@ -388,13 +388,13 @@ public class CustomFormatDataComparerTest
Implementation = "SourceSpecification", Implementation = "SourceSpecification",
Negate = true, Negate = true,
Required = true, Required = true,
Fields = new[] Fields =
{ [
new CustomFormatFieldData new CustomFormatFieldData
{ {
Value = 7 Value = 7
} }
} ]
}, },
new CustomFormatSpecificationData new CustomFormatSpecificationData
{ {
@ -402,15 +402,15 @@ public class CustomFormatDataComparerTest
Implementation = "SourceSpecification", Implementation = "SourceSpecification",
Negate = true, Negate = true,
Required = true, Required = true,
Fields = new[] Fields =
{ [
new CustomFormatFieldData new CustomFormatFieldData
{ {
Value = 8 Value = 8
} }
} ]
} }
} ]
}; };
var result = CustomFormatData.Comparer.Equals(a, b); var result = CustomFormatData.Comparer.Equals(a, b);

@ -41,11 +41,10 @@ public class FieldsArrayJsonConverterTest
var result = var result =
JsonSerializer.Deserialize<CustomFormatSpecificationData>(json, GlobalJsonSerializerSettings.Services); JsonSerializer.Deserialize<CustomFormatSpecificationData>(json, GlobalJsonSerializerSettings.Services);
result!.Fields.Should().BeEquivalentTo(new[] result!.Fields.Should().BeEquivalentTo([
{
new CustomFormatFieldData {Value = 25}, new CustomFormatFieldData {Value = 25},
new CustomFormatFieldData {Value = 40} new CustomFormatFieldData {Value = 40}
}); ]);
} }
[Test] [Test]
@ -69,10 +68,9 @@ public class FieldsArrayJsonConverterTest
var result = var result =
JsonSerializer.Deserialize<CustomFormatSpecificationData>(json, GlobalJsonSerializerSettings.Services); JsonSerializer.Deserialize<CustomFormatSpecificationData>(json, GlobalJsonSerializerSettings.Services);
result!.Fields.Should().BeEquivalentTo(new[] result!.Fields.Should().BeEquivalentTo([
{
new CustomFormatFieldData {Value = "25"} new CustomFormatFieldData {Value = "25"}
}); ]);
} }
[Test] [Test]

@ -16,11 +16,10 @@ public class CustomFormatConfigPhaseTest
var fixture = NSubstituteFixture.Create(); var fixture = NSubstituteFixture.Create();
var guide = fixture.Freeze<ICustomFormatGuideService>(); var guide = fixture.Freeze<ICustomFormatGuideService>();
guide.GetCustomFormatData(default!).ReturnsForAnyArgs(new[] guide.GetCustomFormatData(default!).ReturnsForAnyArgs([
{
NewCf.Data("one", "cf1"), NewCf.Data("one", "cf1"),
NewCf.Data("two", "cf2") NewCf.Data("two", "cf2")
}); ]);
fixture.Inject<IServiceConfiguration>(NewConfig.Radarr() with fixture.Inject<IServiceConfiguration>(NewConfig.Radarr() with
{ {
@ -41,11 +40,10 @@ public class CustomFormatConfigPhaseTest
var sut = fixture.Create<CustomFormatConfigPhase>(); var sut = fixture.Create<CustomFormatConfigPhase>();
sut.Execute(context); sut.Execute(context);
context.ConfigOutput.Should().BeEquivalentTo(new[] context.ConfigOutput.Should().BeEquivalentTo([
{
NewCf.Data("one", "cf1"), NewCf.Data("one", "cf1"),
NewCf.Data("two", "cf2") NewCf.Data("two", "cf2")
}); ]);
} }
[Test] [Test]
@ -54,10 +52,9 @@ public class CustomFormatConfigPhaseTest
var fixture = NSubstituteFixture.Create(); var fixture = NSubstituteFixture.Create();
var guide = fixture.Freeze<ICustomFormatGuideService>(); var guide = fixture.Freeze<ICustomFormatGuideService>();
guide.GetCustomFormatData(default!).ReturnsForAnyArgs(new[] guide.GetCustomFormatData(default!).ReturnsForAnyArgs([
{
NewCf.Data("", "cf4") NewCf.Data("", "cf4")
}); ]);
fixture.Inject<IServiceConfiguration>(NewConfig.Radarr() with fixture.Inject<IServiceConfiguration>(NewConfig.Radarr() with
{ {

@ -123,13 +123,12 @@ public class SonarrMediaNamingConfigPhaseTest
RenameEpisodes = true RenameEpisodes = true
}); });
lookup.Errors.Should().BeEquivalentTo(new[] lookup.Errors.Should().BeEquivalentTo([
{
new InvalidNamingConfig("Season Folder Format", "bad1"), new InvalidNamingConfig("Season Folder Format", "bad1"),
new InvalidNamingConfig("Series Folder Format", "bad2"), new InvalidNamingConfig("Series Folder Format", "bad2"),
new InvalidNamingConfig("Standard Episode Format", "bad3"), new InvalidNamingConfig("Standard Episode Format", "bad3"),
new InvalidNamingConfig("Daily Episode Format", "bad4"), new InvalidNamingConfig("Daily Episode Format", "bad4"),
new InvalidNamingConfig("Anime Episode Format", "bad5") new InvalidNamingConfig("Anime Episode Format", "bad5")
}); ]);
} }
} }

@ -66,11 +66,11 @@ public class QualityProfileDtoTest
{ {
var dto = new QualityProfileDto var dto = new QualityProfileDto
{ {
Items = new[] Items =
{ [
NewQp.QualityDto(1, "one", true), NewQp.QualityDto(1, "one", true),
NewQp.QualityDto(2, "two", true) NewQp.QualityDto(2, "two", true)
} ]
}; };
var result = dto with {Items = Array.Empty<ProfileItemDto>()}; var result = dto with {Items = Array.Empty<ProfileItemDto>()};

@ -24,15 +24,14 @@ public class QualityProfileConfigPhaseTest
var fixture = NSubstituteFixture.Create(); var fixture = NSubstituteFixture.Create();
var cache = fixture.Freeze<ProcessedCustomFormatCache>(); var cache = fixture.Freeze<ProcessedCustomFormatCache>();
cache.AddCustomFormats(new[] cache.AddCustomFormats([
{
NewCf.DataWithScore("", "id1", 101, 1), NewCf.DataWithScore("", "id1", 101, 1),
NewCf.DataWithScore("", "id2", 201, 2) NewCf.DataWithScore("", "id2", 201, 2)
}); ]);
fixture.Inject<IServiceConfiguration>(SetupCfs(new CustomFormatConfig fixture.Inject<IServiceConfiguration>(SetupCfs(new CustomFormatConfig
{ {
TrashIds = new[] {"id1", "id2"}, TrashIds = ["id1", "id2"],
AssignScoresTo = new List<AssignScoresToConfig> AssignScoresTo = new List<AssignScoresToConfig>
{ {
new() new()
@ -48,10 +47,9 @@ public class QualityProfileConfigPhaseTest
sut.Execute(context); sut.Execute(context);
context.ConfigOutput.Should().BeEquivalentTo(new[] context.ConfigOutput.Should().BeEquivalentTo([
{
NewQp.Processed("test_profile", ("id1", 1, 100), ("id2", 2, 100)) NewQp.Processed("test_profile", ("id1", 1, 100), ("id2", 2, 100))
}, ],
o => o.Excluding(x => x.ShouldCreate)); o => o.Excluding(x => x.ShouldCreate));
} }
@ -61,15 +59,14 @@ public class QualityProfileConfigPhaseTest
var fixture = NSubstituteFixture.Create(); var fixture = NSubstituteFixture.Create();
var cache = fixture.Freeze<ProcessedCustomFormatCache>(); var cache = fixture.Freeze<ProcessedCustomFormatCache>();
cache.AddCustomFormats(new[] cache.AddCustomFormats([
{
NewCf.DataWithScore("", "id1", 100, 1), NewCf.DataWithScore("", "id1", 100, 1),
NewCf.DataWithScore("", "id2", 200, 2) NewCf.DataWithScore("", "id2", 200, 2)
}); ]);
fixture.Inject<IServiceConfiguration>(SetupCfs(new CustomFormatConfig fixture.Inject<IServiceConfiguration>(SetupCfs(new CustomFormatConfig
{ {
TrashIds = new[] {"id1", "id2"}, TrashIds = ["id1", "id2"],
AssignScoresTo = new List<AssignScoresToConfig> AssignScoresTo = new List<AssignScoresToConfig>
{ {
new() new()
@ -83,10 +80,9 @@ public class QualityProfileConfigPhaseTest
var sut = fixture.Create<QualityProfileConfigPhase>(); var sut = fixture.Create<QualityProfileConfigPhase>();
sut.Execute(context); sut.Execute(context);
context.ConfigOutput.Should().BeEquivalentTo(new[] context.ConfigOutput.Should().BeEquivalentTo([
{
NewQp.Processed("test_profile", ("id1", 1, 100), ("id2", 2, 200)) NewQp.Processed("test_profile", ("id1", 1, 100), ("id2", 2, 200))
}, ],
o => o.Excluding(x => x.ShouldCreate)); o => o.Excluding(x => x.ShouldCreate));
} }
@ -96,15 +92,14 @@ public class QualityProfileConfigPhaseTest
var fixture = NSubstituteFixture.Create(); var fixture = NSubstituteFixture.Create();
var cache = fixture.Freeze<ProcessedCustomFormatCache>(); var cache = fixture.Freeze<ProcessedCustomFormatCache>();
cache.AddCustomFormats(new[] cache.AddCustomFormats([
{
NewCf.Data("", "id1", 1), NewCf.Data("", "id1", 1),
NewCf.Data("", "id2", 2) NewCf.Data("", "id2", 2)
}); ]);
fixture.Inject<IServiceConfiguration>(SetupCfs(new CustomFormatConfig fixture.Inject<IServiceConfiguration>(SetupCfs(new CustomFormatConfig
{ {
TrashIds = new[] {"id1", "id2"}, TrashIds = ["id1", "id2"],
AssignScoresTo = new List<AssignScoresToConfig> AssignScoresTo = new List<AssignScoresToConfig>
{ {
new() new()
@ -118,10 +113,9 @@ public class QualityProfileConfigPhaseTest
var sut = fixture.Create<QualityProfileConfigPhase>(); var sut = fixture.Create<QualityProfileConfigPhase>();
sut.Execute(context); sut.Execute(context);
context.ConfigOutput.Should().BeEquivalentTo(new[] context.ConfigOutput.Should().BeEquivalentTo([
{
NewQp.Processed("test_profile") NewQp.Processed("test_profile")
}, ],
o => o.Excluding(x => x.ShouldCreate).Excluding(x => x.ScorelessCfs)); o => o.Excluding(x => x.ShouldCreate).Excluding(x => x.ScorelessCfs));
} }
@ -131,19 +125,18 @@ public class QualityProfileConfigPhaseTest
var fixture = NSubstituteFixture.Create(); var fixture = NSubstituteFixture.Create();
var cache = fixture.Freeze<ProcessedCustomFormatCache>(); var cache = fixture.Freeze<ProcessedCustomFormatCache>();
cache.AddCustomFormats(new[] cache.AddCustomFormats([
{
NewCf.DataWithScore("", "id1", 100, 1) NewCf.DataWithScore("", "id1", 100, 1)
}); ]);
fixture.Inject<IServiceConfiguration>(SetupCfs( fixture.Inject<IServiceConfiguration>(SetupCfs(
new CustomFormatConfig new CustomFormatConfig
{ {
TrashIds = new[] {"id1"} TrashIds = ["id1"]
}, },
new CustomFormatConfig new CustomFormatConfig
{ {
TrashIds = new[] {"id1"}, TrashIds = ["id1"],
AssignScoresTo = new List<AssignScoresToConfig> AssignScoresTo = new List<AssignScoresToConfig>
{ {
new() {Name = "test_profile1", Score = 100} new() {Name = "test_profile1", Score = 100}
@ -151,7 +144,7 @@ public class QualityProfileConfigPhaseTest
}, },
new CustomFormatConfig new CustomFormatConfig
{ {
TrashIds = new[] {"id1"}, TrashIds = ["id1"],
AssignScoresTo = new List<AssignScoresToConfig> AssignScoresTo = new List<AssignScoresToConfig>
{ {
new() {Name = "test_profile1", Score = 200} new() {Name = "test_profile1", Score = 200}
@ -159,7 +152,7 @@ public class QualityProfileConfigPhaseTest
}, },
new CustomFormatConfig new CustomFormatConfig
{ {
TrashIds = new[] {"id1"}, TrashIds = ["id1"],
AssignScoresTo = new List<AssignScoresToConfig> AssignScoresTo = new List<AssignScoresToConfig>
{ {
new() {Name = "test_profile2", Score = 200} new() {Name = "test_profile2", Score = 200}
@ -167,7 +160,7 @@ public class QualityProfileConfigPhaseTest
}, },
new CustomFormatConfig new CustomFormatConfig
{ {
TrashIds = new[] {"id1"}, TrashIds = ["id1"],
AssignScoresTo = new List<AssignScoresToConfig> AssignScoresTo = new List<AssignScoresToConfig>
{ {
new() {Name = "test_profile2", Score = 100} new() {Name = "test_profile2", Score = 100}
@ -179,11 +172,10 @@ public class QualityProfileConfigPhaseTest
var sut = fixture.Create<QualityProfileConfigPhase>(); var sut = fixture.Create<QualityProfileConfigPhase>();
sut.Execute(context); sut.Execute(context);
context.ConfigOutput.Should().BeEquivalentTo(new[] context.ConfigOutput.Should().BeEquivalentTo([
{
NewQp.Processed("test_profile1", ("id1", 1, 100)), NewQp.Processed("test_profile1", ("id1", 1, 100)),
NewQp.Processed("test_profile2", ("id1", 1, 200)) NewQp.Processed("test_profile2", ("id1", 1, 200))
}, ],
o => o.Excluding(x => x.ShouldCreate)); o => o.Excluding(x => x.ShouldCreate));
} }
@ -193,33 +185,32 @@ public class QualityProfileConfigPhaseTest
var fixture = NSubstituteFixture.Create(); var fixture = NSubstituteFixture.Create();
var cache = fixture.Freeze<ProcessedCustomFormatCache>(); var cache = fixture.Freeze<ProcessedCustomFormatCache>();
cache.AddCustomFormats(new[] cache.AddCustomFormats([
{
NewCf.DataWithScores("", "id1", 1, ("default", 101), ("set1", 102)), NewCf.DataWithScores("", "id1", 1, ("default", 101), ("set1", 102)),
NewCf.DataWithScores("", "id2", 2, ("default", 201), ("set2", 202)) NewCf.DataWithScores("", "id2", 2, ("default", 201), ("set2", 202))
}); ]);
var config = NewConfig.Radarr() with var config = NewConfig.Radarr() with
{ {
CustomFormats = new[] CustomFormats =
{ [
new CustomFormatConfig new CustomFormatConfig
{ {
TrashIds = new[] {"id1", "id2"}, TrashIds = ["id1", "id2"],
AssignScoresTo = new[] AssignScoresTo =
{ [
new AssignScoresToConfig {Name = "test_profile"} new AssignScoresToConfig {Name = "test_profile"}
} ]
} }
}, ],
QualityProfiles = new[] QualityProfiles =
{ [
new QualityProfileConfig new QualityProfileConfig
{ {
Name = "test_profile", Name = "test_profile",
ScoreSet = "set1" ScoreSet = "set1"
} }
} ]
}; };
fixture.Inject<IServiceConfiguration>(config); fixture.Inject<IServiceConfiguration>(config);
@ -227,13 +218,12 @@ public class QualityProfileConfigPhaseTest
var sut = fixture.Create<QualityProfileConfigPhase>(); var sut = fixture.Create<QualityProfileConfigPhase>();
sut.Execute(context); sut.Execute(context);
context.ConfigOutput.Should().BeEquivalentTo(new[] context.ConfigOutput.Should().BeEquivalentTo([
{
NewQp.Processed("test_profile", ("id1", 1, 102), ("id2", 2, 201)) with NewQp.Processed("test_profile", ("id1", 1, 102), ("id2", 2, 201)) with
{ {
Profile = config.QualityProfiles.First() Profile = config.QualityProfiles.First()
} }
}, ],
o => o.Excluding(x => x.ShouldCreate)); o => o.Excluding(x => x.ShouldCreate));
} }
@ -268,15 +258,14 @@ public class QualityProfileConfigPhaseTest
var fixture = NSubstituteFixture.Create(); var fixture = NSubstituteFixture.Create();
var cache = fixture.Freeze<ProcessedCustomFormatCache>(); var cache = fixture.Freeze<ProcessedCustomFormatCache>();
cache.AddCustomFormats(new[] cache.AddCustomFormats([
{
NewCf.DataWithScore("", "id1", 101, 1), NewCf.DataWithScore("", "id1", 101, 1),
NewCf.DataWithScore("", "id2", 201, 2) NewCf.DataWithScore("", "id2", 201, 2)
}); ]);
fixture.Inject<IServiceConfiguration>(SetupCfs(new CustomFormatConfig fixture.Inject<IServiceConfiguration>(SetupCfs(new CustomFormatConfig
{ {
TrashIds = new[] {"id1", "id2"}, TrashIds = ["id1", "id2"],
AssignScoresTo = Array.Empty<AssignScoresToConfig>() AssignScoresTo = Array.Empty<AssignScoresToConfig>()
})); }));

@ -20,14 +20,14 @@ public class QualityProfileTransactionPhaseTest
var context = new QualityProfilePipelineContext var context = new QualityProfilePipelineContext
{ {
ConfigOutput = new[] ConfigOutput =
{ [
NewQp.Processed("invalid_profile_name") with NewQp.Processed("invalid_profile_name") with
{ {
ShouldCreate = false ShouldCreate = false
}, },
NewQp.Processed("profile1") NewQp.Processed("profile1")
}, ],
ApiFetchOutput = new QualityProfileServiceData(dtos, new QualityProfileDto()) ApiFetchOutput = new QualityProfileServiceData(dtos, new QualityProfileDto())
}; };
@ -35,7 +35,7 @@ public class QualityProfileTransactionPhaseTest
context.TransactionOutput.Should().BeEquivalentTo(new QualityProfileTransactionData context.TransactionOutput.Should().BeEquivalentTo(new QualityProfileTransactionData
{ {
NonExistentProfiles = new[] {"invalid_profile_name"}, NonExistentProfiles = ["invalid_profile_name"],
UnchangedProfiles = new List<ProfileWithStats> UnchangedProfiles = new List<ProfileWithStats>
{ {
new() new()
@ -62,28 +62,28 @@ public class QualityProfileTransactionPhaseTest
var context = new QualityProfilePipelineContext var context = new QualityProfilePipelineContext
{ {
ConfigOutput = new[] ConfigOutput =
{ [
new ProcessedQualityProfileData new ProcessedQualityProfileData
{ {
Profile = new QualityProfileConfig Profile = new QualityProfileConfig
{ {
Name = "profile1", Name = "profile1",
Qualities = new[] Qualities =
{ [
new QualityProfileQualityConfig {Name = "quality1", Enabled = true} new QualityProfileQualityConfig {Name = "quality1", Enabled = true}
} ]
} }
} }
}, ],
ApiFetchOutput = new QualityProfileServiceData(dtos, new QualityProfileDto()) ApiFetchOutput = new QualityProfileServiceData(dtos, new QualityProfileDto())
{ {
Schema = new QualityProfileDto Schema = new QualityProfileDto
{ {
Items = new[] Items =
{ [
new ProfileItemDto {Quality = new ProfileItemQualityDto {Name = "quality1"}} new ProfileItemDto {Quality = new ProfileItemQualityDto {Name = "quality1"}}
} ]
} }
} }
}; };
@ -105,8 +105,8 @@ public class QualityProfileTransactionPhaseTest
UpdatedQualities = new UpdatedQualities UpdatedQualities = new UpdatedQualities
{ {
NumWantedItems = 1, NumWantedItems = 1,
Items = new[] Items =
{ [
new ProfileItemDto new ProfileItemDto
{ {
Allowed = true, Allowed = true,
@ -115,7 +115,7 @@ public class QualityProfileTransactionPhaseTest
Name = "quality1" Name = "quality1"
} }
} }
} ]
} }
} }
} }
@ -132,8 +132,8 @@ public class QualityProfileTransactionPhaseTest
new QualityProfileDto new QualityProfileDto
{ {
Name = "profile1", Name = "profile1",
FormatItems = new[] FormatItems =
{ [
new ProfileFormatItemDto new ProfileFormatItemDto
{ {
Name = "quality1", Name = "quality1",
@ -146,16 +146,16 @@ public class QualityProfileTransactionPhaseTest
Format = 2, Format = 2,
Score = 300 Score = 300
} }
} ]
} }
}; };
var context = new QualityProfilePipelineContext var context = new QualityProfilePipelineContext
{ {
ConfigOutput = new[] ConfigOutput =
{ [
NewQp.Processed("profile1", ("id1", 1, 100), ("id2", 2, 500)) NewQp.Processed("profile1", ("id1", 1, 100), ("id2", 2, 500))
}, ],
ApiFetchOutput = new QualityProfileServiceData(dtos, new QualityProfileDto()) ApiFetchOutput = new QualityProfileServiceData(dtos, new QualityProfileDto())
}; };
@ -163,11 +163,10 @@ public class QualityProfileTransactionPhaseTest
context.TransactionOutput.ChangedProfiles.Should() context.TransactionOutput.ChangedProfiles.Should()
.ContainSingle().Which.Profile.UpdatedScores.Should() .ContainSingle().Which.Profile.UpdatedScores.Should()
.BeEquivalentTo(new[] .BeEquivalentTo([
{
NewQp.UpdatedScore("quality1", 200, 100, FormatScoreUpdateReason.Updated), NewQp.UpdatedScore("quality1", 200, 100, FormatScoreUpdateReason.Updated),
NewQp.UpdatedScore("quality2", 300, 500, FormatScoreUpdateReason.Updated) NewQp.UpdatedScore("quality2", 300, 500, FormatScoreUpdateReason.Updated)
}, o => o.Excluding(x => x.Dto.Format)); ], o => o.Excluding(x => x.Dto.Format));
} }
[Test, AutoMockData] [Test, AutoMockData]
@ -179,8 +178,8 @@ public class QualityProfileTransactionPhaseTest
new QualityProfileDto new QualityProfileDto
{ {
Name = "profile1", Name = "profile1",
FormatItems = new[] FormatItems =
{ [
new ProfileFormatItemDto new ProfileFormatItemDto
{ {
Name = "quality1", Name = "quality1",
@ -193,7 +192,7 @@ public class QualityProfileTransactionPhaseTest
Format = 2, Format = 2,
Score = 300 Score = 300
} }
} ]
} }
}; };
@ -217,8 +216,8 @@ public class QualityProfileTransactionPhaseTest
new QualityProfileDto new QualityProfileDto
{ {
Name = "profile1", Name = "profile1",
FormatItems = new[] FormatItems =
{ [
new ProfileFormatItemDto new ProfileFormatItemDto
{ {
Name = "quality1", Name = "quality1",
@ -231,7 +230,7 @@ public class QualityProfileTransactionPhaseTest
Format = 2, Format = 2,
Score = 300 Score = 300
} }
} ]
} }
}; };
@ -239,10 +238,10 @@ public class QualityProfileTransactionPhaseTest
{ {
// Must simulate at least 1 custom format coming from configuration otherwise processing doesn't happen. // Must simulate at least 1 custom format coming from configuration otherwise processing doesn't happen.
// Profile name must match but the format IDs for each quality should not // Profile name must match but the format IDs for each quality should not
ConfigOutput = new[] ConfigOutput =
{ [
NewQp.Processed("profile1", ("id1", 1, 200), ("id2", 2, 300)) NewQp.Processed("profile1", ("id1", 1, 200), ("id2", 2, 300))
}, ],
ApiFetchOutput = new QualityProfileServiceData(dtos, new QualityProfileDto()) ApiFetchOutput = new QualityProfileServiceData(dtos, new QualityProfileDto())
}; };
@ -250,11 +249,10 @@ public class QualityProfileTransactionPhaseTest
context.TransactionOutput.UnchangedProfiles.Should() context.TransactionOutput.UnchangedProfiles.Should()
.ContainSingle().Which.Profile.UpdatedScores.Should() .ContainSingle().Which.Profile.UpdatedScores.Should()
.BeEquivalentTo(new[] .BeEquivalentTo([
{
NewQp.UpdatedScore("quality1", 200, 200, FormatScoreUpdateReason.NoChange), NewQp.UpdatedScore("quality1", 200, 200, FormatScoreUpdateReason.NoChange),
NewQp.UpdatedScore("quality2", 300, 300, FormatScoreUpdateReason.NoChange) NewQp.UpdatedScore("quality2", 300, 300, FormatScoreUpdateReason.NoChange)
}, o => o.Excluding(x => x.Dto.Format)); ], o => o.Excluding(x => x.Dto.Format));
} }
[Test, AutoMockData] [Test, AutoMockData]
@ -266,8 +264,8 @@ public class QualityProfileTransactionPhaseTest
new QualityProfileDto new QualityProfileDto
{ {
Name = "profile1", Name = "profile1",
FormatItems = new[] FormatItems =
{ [
new ProfileFormatItemDto new ProfileFormatItemDto
{ {
Name = "quality1", Name = "quality1",
@ -280,16 +278,16 @@ public class QualityProfileTransactionPhaseTest
Format = 2, Format = 2,
Score = 300 Score = 300
} }
} ]
} }
}; };
var context = new QualityProfilePipelineContext var context = new QualityProfilePipelineContext
{ {
ConfigOutput = new[] ConfigOutput =
{ [
NewQp.Processed("profile1", true, ("quality3", "id3", 3, 100), ("quality4", "id4", 4, 500)) NewQp.Processed("profile1", true, ("quality3", "id3", 3, 100), ("quality4", "id4", 4, 500))
}, ],
ApiFetchOutput = new QualityProfileServiceData(dtos, new QualityProfileDto()) ApiFetchOutput = new QualityProfileServiceData(dtos, new QualityProfileDto())
}; };
@ -297,13 +295,12 @@ public class QualityProfileTransactionPhaseTest
context.TransactionOutput.ChangedProfiles.Should() context.TransactionOutput.ChangedProfiles.Should()
.ContainSingle().Which.Profile.UpdatedScores.Should() .ContainSingle().Which.Profile.UpdatedScores.Should()
.BeEquivalentTo(new[] .BeEquivalentTo([
{
NewQp.UpdatedScore("quality1", 200, 0, FormatScoreUpdateReason.Reset), NewQp.UpdatedScore("quality1", 200, 0, FormatScoreUpdateReason.Reset),
NewQp.UpdatedScore("quality2", 300, 0, FormatScoreUpdateReason.Reset), NewQp.UpdatedScore("quality2", 300, 0, FormatScoreUpdateReason.Reset),
NewQp.UpdatedScore("quality3", 0, 100, FormatScoreUpdateReason.New), NewQp.UpdatedScore("quality3", 0, 100, FormatScoreUpdateReason.New),
NewQp.UpdatedScore("quality4", 0, 500, FormatScoreUpdateReason.New) NewQp.UpdatedScore("quality4", 0, 500, FormatScoreUpdateReason.New)
}, o => o.Excluding(x => x.Dto.Format)); ], o => o.Excluding(x => x.Dto.Format));
} }
[Test, AutoMockData] [Test, AutoMockData]
@ -314,8 +311,8 @@ public class QualityProfileTransactionPhaseTest
new QualityProfileDto new QualityProfileDto
{ {
Name = "profile1", Name = "profile1",
FormatItems = new[] FormatItems =
{ [
new ProfileFormatItemDto new ProfileFormatItemDto
{ {
Name = "cf1", Name = "cf1",
@ -328,14 +325,14 @@ public class QualityProfileTransactionPhaseTest
Format = 2, Format = 2,
Score = 300 Score = 300
} }
} ]
} }
}; };
var context = new QualityProfilePipelineContext var context = new QualityProfilePipelineContext
{ {
ConfigOutput = new[] ConfigOutput =
{ [
NewQp.Processed(new QualityProfileConfig NewQp.Processed(new QualityProfileConfig
{ {
Name = "profile1", Name = "profile1",
@ -344,11 +341,11 @@ public class QualityProfileTransactionPhaseTest
Enabled = false, Enabled = false,
// Throw in some exceptions here, just to test whether or not these somehow affect the // Throw in some exceptions here, just to test whether or not these somehow affect the
// result despite Enable being set to false. // result despite Enable being set to false.
Except = new[] {"cf1"} Except = ["cf1"]
} }
}, },
("cf3", "id3", 3, 100), ("cf4", "id4", 4, 500)) ("cf3", "id3", 3, 100), ("cf4", "id4", 4, 500))
}, ],
ApiFetchOutput = new QualityProfileServiceData(dtos, new QualityProfileDto()) ApiFetchOutput = new QualityProfileServiceData(dtos, new QualityProfileDto())
}; };
@ -356,13 +353,12 @@ public class QualityProfileTransactionPhaseTest
context.TransactionOutput.ChangedProfiles.Should() context.TransactionOutput.ChangedProfiles.Should()
.ContainSingle().Which.Profile.UpdatedScores.Should() .ContainSingle().Which.Profile.UpdatedScores.Should()
.BeEquivalentTo(new[] .BeEquivalentTo([
{
NewQp.UpdatedScore("cf1", 200, 200, FormatScoreUpdateReason.NoChange), NewQp.UpdatedScore("cf1", 200, 200, FormatScoreUpdateReason.NoChange),
NewQp.UpdatedScore("cf2", 300, 300, FormatScoreUpdateReason.NoChange), NewQp.UpdatedScore("cf2", 300, 300, FormatScoreUpdateReason.NoChange),
NewQp.UpdatedScore("cf3", 0, 100, FormatScoreUpdateReason.New), NewQp.UpdatedScore("cf3", 0, 100, FormatScoreUpdateReason.New),
NewQp.UpdatedScore("cf4", 0, 500, FormatScoreUpdateReason.New) NewQp.UpdatedScore("cf4", 0, 500, FormatScoreUpdateReason.New)
}, o => o.Excluding(x => x.Dto.Format)); ], o => o.Excluding(x => x.Dto.Format));
} }
[Test, AutoMockData] [Test, AutoMockData]
@ -373,8 +369,8 @@ public class QualityProfileTransactionPhaseTest
new QualityProfileDto new QualityProfileDto
{ {
Name = "profile1", Name = "profile1",
FormatItems = new[] FormatItems =
{ [
new ProfileFormatItemDto new ProfileFormatItemDto
{ {
Name = "cf1", Name = "cf1",
@ -387,25 +383,25 @@ public class QualityProfileTransactionPhaseTest
Format = 2, Format = 2,
Score = 300 Score = 300
} }
} ]
} }
}; };
var context = new QualityProfilePipelineContext var context = new QualityProfilePipelineContext
{ {
ConfigOutput = new[] ConfigOutput =
{ [
NewQp.Processed(new QualityProfileConfig NewQp.Processed(new QualityProfileConfig
{ {
Name = "profile1", Name = "profile1",
ResetUnmatchedScores = new ResetUnmatchedScoresConfig ResetUnmatchedScores = new ResetUnmatchedScoresConfig
{ {
Enabled = true, Enabled = true,
Except = new[] {"cf1"} Except = ["cf1"]
} }
}, },
("cf3", "id3", 3, 100), ("cf4", "id4", 4, 500)) ("cf3", "id3", 3, 100), ("cf4", "id4", 4, 500))
}, ],
ApiFetchOutput = new QualityProfileServiceData(dtos, new QualityProfileDto()) ApiFetchOutput = new QualityProfileServiceData(dtos, new QualityProfileDto())
}; };
@ -413,13 +409,12 @@ public class QualityProfileTransactionPhaseTest
context.TransactionOutput.ChangedProfiles.Should() context.TransactionOutput.ChangedProfiles.Should()
.ContainSingle().Which.Profile.UpdatedScores.Should() .ContainSingle().Which.Profile.UpdatedScores.Should()
.BeEquivalentTo(new[] .BeEquivalentTo([
{
NewQp.UpdatedScore("cf1", 200, 200, FormatScoreUpdateReason.NoChange), NewQp.UpdatedScore("cf1", 200, 200, FormatScoreUpdateReason.NoChange),
NewQp.UpdatedScore("cf2", 300, 0, FormatScoreUpdateReason.Reset), NewQp.UpdatedScore("cf2", 300, 0, FormatScoreUpdateReason.Reset),
NewQp.UpdatedScore("cf3", 0, 100, FormatScoreUpdateReason.New), NewQp.UpdatedScore("cf3", 0, 100, FormatScoreUpdateReason.New),
NewQp.UpdatedScore("cf4", 0, 500, FormatScoreUpdateReason.New) NewQp.UpdatedScore("cf4", 0, 500, FormatScoreUpdateReason.New)
}, o => o.Excluding(x => x.Dto.Format)); ], o => o.Excluding(x => x.Dto.Format));
} }
[Test, AutoMockData] [Test, AutoMockData]
@ -430,8 +425,8 @@ public class QualityProfileTransactionPhaseTest
new QualityProfileDto new QualityProfileDto
{ {
Name = "profile1", Name = "profile1",
FormatItems = new[] FormatItems =
{ [
new ProfileFormatItemDto new ProfileFormatItemDto
{ {
Name = "cf1", Name = "cf1",
@ -444,24 +439,24 @@ public class QualityProfileTransactionPhaseTest
Format = 2, Format = 2,
Score = 300 Score = 300
} }
} ]
} }
}; };
var context = new QualityProfilePipelineContext var context = new QualityProfilePipelineContext
{ {
ConfigOutput = new[] ConfigOutput =
{ [
NewQp.Processed(new QualityProfileConfig NewQp.Processed(new QualityProfileConfig
{ {
Name = "profile1", Name = "profile1",
ResetUnmatchedScores = new ResetUnmatchedScoresConfig ResetUnmatchedScores = new ResetUnmatchedScoresConfig
{ {
Enabled = true, Enabled = true,
Except = new[] {"cf50"} Except = ["cf50"]
} }
}) })
}, ],
ApiFetchOutput = new QualityProfileServiceData(dtos, new QualityProfileDto()) ApiFetchOutput = new QualityProfileServiceData(dtos, new QualityProfileDto())
}; };
@ -480,8 +475,8 @@ public class QualityProfileTransactionPhaseTest
new QualityProfileDto new QualityProfileDto
{ {
Name = "profile1", Name = "profile1",
Items = new[] Items =
{ [
new ProfileItemDto new ProfileItemDto
{ {
Quality = new ProfileItemQualityDto {Id = 1, Name = "One"} Quality = new ProfileItemQualityDto {Id = 1, Name = "One"}
@ -490,14 +485,14 @@ public class QualityProfileTransactionPhaseTest
{ {
Quality = new ProfileItemQualityDto {Id = 2, Name = "Two"} Quality = new ProfileItemQualityDto {Id = 2, Name = "Two"}
} }
} ]
} }
}; };
var context = new QualityProfilePipelineContext var context = new QualityProfilePipelineContext
{ {
ConfigOutput = new[] ConfigOutput =
{ [
new ProcessedQualityProfileData new ProcessedQualityProfileData
{ {
Profile = new QualityProfileConfig Profile = new QualityProfileConfig
@ -505,17 +500,17 @@ public class QualityProfileTransactionPhaseTest
Name = "profile1" Name = "profile1"
} }
} }
}, ],
ApiFetchOutput = new QualityProfileServiceData(dtos, new QualityProfileDto()) ApiFetchOutput = new QualityProfileServiceData(dtos, new QualityProfileDto())
{ {
Schema = new QualityProfileDto Schema = new QualityProfileDto
{ {
Items = new[] Items =
{ [
new ProfileItemDto {Quality = new ProfileItemQualityDto {Id = 1, Name = "One"}}, new ProfileItemDto {Quality = new ProfileItemQualityDto {Id = 1, Name = "One"}},
new ProfileItemDto {Quality = new ProfileItemQualityDto {Id = 2, Name = "Two"}}, new ProfileItemDto {Quality = new ProfileItemQualityDto {Id = 2, Name = "Two"}},
new ProfileItemDto {Quality = new ProfileItemQualityDto {Id = 3, Name = "Three"}} new ProfileItemDto {Quality = new ProfileItemQualityDto {Id = 3, Name = "Three"}}
} ]
} }
} }
}; };

@ -9,8 +9,8 @@ public class QualityItemOrganizerTest
{ {
private readonly QualityProfileConfig _config = new() private readonly QualityProfileConfig _config = new()
{ {
Qualities = new[] Qualities =
{ [
NewQp.QualityConfig("one"), NewQp.QualityConfig("one"),
NewQp.QualityConfig("three"), NewQp.QualityConfig("three"),
NewQp.QualityConfig("six", false), NewQp.QualityConfig("six", false),
@ -19,13 +19,13 @@ public class QualityItemOrganizerTest
NewQp.GroupConfig("group3", "eight"), NewQp.GroupConfig("group3", "eight"),
NewQp.GroupConfig("group4", false, "nine", "ten"), NewQp.GroupConfig("group4", false, "nine", "ten"),
NewQp.GroupConfig("group5", "eleven") NewQp.GroupConfig("group5", "eleven")
} ]
}; };
private readonly QualityProfileDto _dto = new() private readonly QualityProfileDto _dto = new()
{ {
Items = new[] Items =
{ [
NewQp.QualityDto(1, "one", true), NewQp.QualityDto(1, "one", true),
NewQp.QualityDto(2, "two", true), NewQp.QualityDto(2, "two", true),
NewQp.QualityDto(3, "three", true), NewQp.QualityDto(3, "three", true),
@ -40,7 +40,7 @@ public class QualityItemOrganizerTest
NewQp.GroupDto(1002, "group2", true, NewQp.GroupDto(1002, "group2", true,
NewQp.QualityDto(7, "seven", true)), NewQp.QualityDto(7, "seven", true)),
NewQp.QualityDto(8, "eight", true) NewQp.QualityDto(8, "eight", true)
} ]
}; };
[Test] [Test]
@ -54,10 +54,10 @@ public class QualityItemOrganizerTest
result.Should().BeEquivalentTo(new UpdatedQualities result.Should().BeEquivalentTo(new UpdatedQualities
{ {
InvalidQualityNames = new[] {"nonexistent1"}, InvalidQualityNames = ["nonexistent1"],
NumWantedItems = 7, NumWantedItems = 7,
Items = new[] Items =
{ [
// ------ IN CONFIG ------ // ------ IN CONFIG ------
NewQp.QualityDto(1, "one", true), NewQp.QualityDto(1, "one", true),
NewQp.QualityDto(3, "three", true), NewQp.QualityDto(3, "three", true),
@ -74,7 +74,7 @@ public class QualityItemOrganizerTest
NewQp.QualityDto(2, "two", false), NewQp.QualityDto(2, "two", false),
NewQp.QualityDto(4, "four", false), NewQp.QualityDto(4, "four", false),
NewQp.QualityDto(5, "five", false) NewQp.QualityDto(5, "five", false)
} ]
}); });
} }
@ -89,10 +89,10 @@ public class QualityItemOrganizerTest
result.Should().BeEquivalentTo(new UpdatedQualities result.Should().BeEquivalentTo(new UpdatedQualities
{ {
InvalidQualityNames = new[] {"nonexistent1"}, InvalidQualityNames = ["nonexistent1"],
NumWantedItems = 7, NumWantedItems = 7,
Items = new[] Items =
{ [
// ------ NOT IN CONFIG ------ // ------ NOT IN CONFIG ------
NewQp.QualityDto(2, "two", false), NewQp.QualityDto(2, "two", false),
NewQp.QualityDto(4, "four", false), NewQp.QualityDto(4, "four", false),
@ -109,7 +109,7 @@ public class QualityItemOrganizerTest
NewQp.QualityDto(10, "ten", false)), NewQp.QualityDto(10, "ten", false)),
NewQp.GroupDto(50, "group5", true, NewQp.GroupDto(50, "group5", true,
NewQp.QualityDto(11, "eleven", true)) NewQp.QualityDto(11, "eleven", true))
} ]
}); });
} }
@ -118,28 +118,27 @@ public class QualityItemOrganizerTest
{ {
var config = new QualityProfileConfig var config = new QualityProfileConfig
{ {
Qualities = new[] Qualities =
{ [
NewQp.QualityConfig("one") NewQp.QualityConfig("one")
} ]
}; };
var dto = new QualityProfileDto var dto = new QualityProfileDto
{ {
Items = new[] Items =
{ [
NewQp.GroupDto(1001, "group1", true, NewQp.GroupDto(1001, "group1", true,
NewQp.QualityDto(1, "one", true)) NewQp.QualityDto(1, "one", true))
} ]
}; };
var sut = new QualityItemOrganizer(); var sut = new QualityItemOrganizer();
var result = sut.OrganizeItems(dto, config); var result = sut.OrganizeItems(dto, config);
result.Items.Should().BeEquivalentTo(new[] result.Items.Should().BeEquivalentTo([
{
NewQp.QualityDto(1, "one", true) NewQp.QualityDto(1, "one", true)
}); ]);
} }
[Test] [Test]
@ -147,30 +146,29 @@ public class QualityItemOrganizerTest
{ {
var config = new QualityProfileConfig var config = new QualityProfileConfig
{ {
Qualities = new[] Qualities =
{ [
NewQp.QualityConfig("one") NewQp.QualityConfig("one")
} ]
}; };
var dto = new QualityProfileDto var dto = new QualityProfileDto
{ {
Items = new[] Items =
{ [
NewQp.GroupDto(1001, "group1", true, NewQp.GroupDto(1001, "group1", true,
NewQp.QualityDto(1, "one", true), NewQp.QualityDto(1, "one", true),
NewQp.QualityDto(2, "two", true)) NewQp.QualityDto(2, "two", true))
} ]
}; };
var sut = new QualityItemOrganizer(); var sut = new QualityItemOrganizer();
var result = sut.OrganizeItems(dto, config); var result = sut.OrganizeItems(dto, config);
result.Items.Should().BeEquivalentTo(new[] result.Items.Should().BeEquivalentTo([
{
NewQp.QualityDto(1, "one", true), NewQp.QualityDto(1, "one", true),
NewQp.QualityDto(2, "two", false) NewQp.QualityDto(2, "two", false)
}); ]);
} }
[Test] [Test]
@ -178,33 +176,32 @@ public class QualityItemOrganizerTest
{ {
var config = new QualityProfileConfig var config = new QualityProfileConfig
{ {
Qualities = new[] Qualities =
{ [
NewQp.QualityConfig("one") NewQp.QualityConfig("one")
} ]
}; };
var dto = new QualityProfileDto var dto = new QualityProfileDto
{ {
Items = new[] Items =
{ [
NewQp.GroupDto(1001, "group1", true, NewQp.GroupDto(1001, "group1", true,
NewQp.QualityDto(1, "one", true), NewQp.QualityDto(1, "one", true),
NewQp.QualityDto(2, "two", true), NewQp.QualityDto(2, "two", true),
NewQp.QualityDto(3, "three", true)) NewQp.QualityDto(3, "three", true))
} ]
}; };
var sut = new QualityItemOrganizer(); var sut = new QualityItemOrganizer();
var result = sut.OrganizeItems(dto, config); var result = sut.OrganizeItems(dto, config);
result.Items.Should().BeEquivalentTo(new[] result.Items.Should().BeEquivalentTo([
{
NewQp.QualityDto(1, "one", true), NewQp.QualityDto(1, "one", true),
NewQp.GroupDto(1001, "group1", false, NewQp.GroupDto(1001, "group1", false,
NewQp.QualityDto(2, "two", false), NewQp.QualityDto(2, "two", false),
NewQp.QualityDto(3, "three", false)) NewQp.QualityDto(3, "three", false))
}); ]);
} }
[Test] [Test]
@ -212,34 +209,33 @@ public class QualityItemOrganizerTest
{ {
var config = new QualityProfileConfig var config = new QualityProfileConfig
{ {
Qualities = new[] Qualities =
{ [
NewQp.GroupConfig("group1", "one", "two", "three") NewQp.GroupConfig("group1", "one", "two", "three")
} ]
}; };
var dto = new QualityProfileDto var dto = new QualityProfileDto
{ {
Items = new[] Items =
{ [
NewQp.GroupDto(1001, "group1", true, NewQp.GroupDto(1001, "group1", true,
NewQp.QualityDto(1, "one", true), NewQp.QualityDto(1, "one", true),
NewQp.QualityDto(2, "two", true), NewQp.QualityDto(2, "two", true),
NewQp.QualityDto(3, "three", true), NewQp.QualityDto(3, "three", true),
NewQp.QualityDto(4, "four", true)) NewQp.QualityDto(4, "four", true))
} ]
}; };
var sut = new QualityItemOrganizer(); var sut = new QualityItemOrganizer();
var result = sut.OrganizeItems(dto, config); var result = sut.OrganizeItems(dto, config);
result.Items.Should().BeEquivalentTo(new[] result.Items.Should().BeEquivalentTo([
{
NewQp.GroupDto(1001, "group1", true, NewQp.GroupDto(1001, "group1", true,
NewQp.QualityDto(1, "one", true), NewQp.QualityDto(1, "one", true),
NewQp.QualityDto(2, "two", true), NewQp.QualityDto(2, "two", true),
NewQp.QualityDto(3, "three", true)), NewQp.QualityDto(3, "three", true)),
NewQp.QualityDto(4, "four", false) NewQp.QualityDto(4, "four", false)
}); ]);
} }
} }

@ -386,8 +386,7 @@ public class QualityProfileExtensionsTest
var result = dto.ReverseItems(); var result = dto.ReverseItems();
result.Items.Should().BeEquivalentTo(new[] result.Items.Should().BeEquivalentTo([
{
NewQp.GroupDto(1003, "Group 3", true, NewQp.GroupDto(1003, "Group 3", true,
NewQp.QualityDto(4, "Quality 4", true)), NewQp.QualityDto(4, "Quality 4", true)),
NewQp.GroupDto(1002, "Group 2", true, NewQp.GroupDto(1002, "Group 2", true,
@ -395,7 +394,7 @@ public class QualityProfileExtensionsTest
NewQp.QualityDto(2, "Quality 2", true)), NewQp.QualityDto(2, "Quality 2", true)),
NewQp.QualityDto(1, "Quality 1", true), NewQp.QualityDto(1, "Quality 1", true),
NewQp.GroupDto(1001, "Group 1", true) NewQp.GroupDto(1001, "Group 1", true)
}); ]);
} }
[Test] [Test]

@ -127,10 +127,10 @@ public class UpdatedQualityProfileTest
ProfileConfig = NewQp.Processed("config_name"), ProfileConfig = NewQp.Processed("config_name"),
UpdatedQualities = new UpdatedQualities UpdatedQualities = new UpdatedQualities
{ {
Items = new[] Items =
{ [
new ProfileItemDto() new ProfileItemDto()
} ]
}, },
UpdateReason = QualityProfileUpdateReason.New UpdateReason = QualityProfileUpdateReason.New
}; };

@ -18,13 +18,13 @@ public class UpdatedQualityProfileValidatorTest
var updatedProfile = new UpdatedQualityProfile var updatedProfile = new UpdatedQualityProfile
{ {
UpdatedScores = new[] UpdatedScores =
{ [
NewQp.UpdatedScore("foo1", 0, 100, FormatScoreUpdateReason.New), NewQp.UpdatedScore("foo1", 0, 100, FormatScoreUpdateReason.New),
NewQp.UpdatedScore("foo2", 0, -100, FormatScoreUpdateReason.Updated), NewQp.UpdatedScore("foo2", 0, -100, FormatScoreUpdateReason.Updated),
NewQp.UpdatedScore("foo3", 0, 200, FormatScoreUpdateReason.NoChange), NewQp.UpdatedScore("foo3", 0, 200, FormatScoreUpdateReason.NoChange),
NewQp.UpdatedScore("foo4", 0, 100, FormatScoreUpdateReason.Reset) NewQp.UpdatedScore("foo4", 0, 100, FormatScoreUpdateReason.Reset)
}, ],
ProfileDto = new QualityProfileDto {Name = "ProfileName"}, ProfileDto = new QualityProfileDto {Name = "ProfileName"},
ProfileConfig = NewQp.Processed(profileConfig), ProfileConfig = NewQp.Processed(profileConfig),
UpdateReason = QualityProfileUpdateReason.Changed UpdateReason = QualityProfileUpdateReason.Changed
@ -60,7 +60,7 @@ public class UpdatedQualityProfileValidatorTest
{ {
UpdatedQualities = new UpdatedQualities UpdatedQualities = new UpdatedQualities
{ {
InvalidQualityNames = new[] {"foo1"} InvalidQualityNames = ["foo1"]
}, },
ProfileDto = new QualityProfileDto(), ProfileDto = new QualityProfileDto(),
ProfileConfig = NewQp.Processed(profileConfig), ProfileConfig = NewQp.Processed(profileConfig),
@ -105,10 +105,10 @@ public class UpdatedQualityProfileValidatorTest
{ {
ProfileDto = new QualityProfileDto ProfileDto = new QualityProfileDto
{ {
Items = new[] Items =
{ [
NewQp.QualityDto(1, "disabled_quality", false) NewQp.QualityDto(1, "disabled_quality", false)
} ]
}, },
ProfileConfig = NewQp.Processed(profileConfig), ProfileConfig = NewQp.Processed(profileConfig),
UpdateReason = QualityProfileUpdateReason.New UpdateReason = QualityProfileUpdateReason.New

@ -31,10 +31,9 @@ public class QualitySizeConfigPhaseTest
{ {
config.QualityDefinition.Returns(new QualityDefinitionConfig {Type = "not_real"}); config.QualityDefinition.Returns(new QualityDefinitionConfig {Type = "not_real"});
guide.GetQualitySizeData(default!).ReturnsForAnyArgs(new[] guide.GetQualitySizeData(default!).ReturnsForAnyArgs([
{
new QualitySizeData {Type = "real"} new QualitySizeData {Type = "real"}
}); ]);
var context = new QualitySizePipelineContext(); var context = new QualitySizePipelineContext();
@ -59,10 +58,9 @@ public class QualitySizeConfigPhaseTest
PreferredRatio = decimal.Parse(testPreferred) PreferredRatio = decimal.Parse(testPreferred)
}); });
guide.GetQualitySizeData(default!).ReturnsForAnyArgs(new[] guide.GetQualitySizeData(default!).ReturnsForAnyArgs([
{
new QualitySizeData {Type = "real"} new QualitySizeData {Type = "real"}
}); ]);
var context = new QualitySizePipelineContext(); var context = new QualitySizePipelineContext();
@ -85,27 +83,25 @@ public class QualitySizeConfigPhaseTest
PreferredRatio = 0.5m PreferredRatio = 0.5m
}); });
guide.GetQualitySizeData(default!).ReturnsForAnyArgs(new[] guide.GetQualitySizeData(default!).ReturnsForAnyArgs([
{
new QualitySizeData new QualitySizeData
{ {
Type = "real", Type = "real",
Qualities = new[] Qualities =
{ [
new QualityItem("quality1", 0, 100, 90) new QualityItem("quality1", 0, 100, 90)
} ]
} }
}); ]);
var context = new QualitySizePipelineContext(); var context = new QualitySizePipelineContext();
sut.Execute(context); sut.Execute(context);
context.ConfigOutput.Should().NotBeNull(); context.ConfigOutput.Should().NotBeNull();
context.ConfigOutput!.Qualities.Select(x => x.Item).Should().BeEquivalentTo(new[] context.ConfigOutput!.Qualities.Select(x => x.Item).Should().BeEquivalentTo([
{
new QualityItem("quality1", 0, 100, 50) new QualityItem("quality1", 0, 100, 50)
}); ]);
} }
[Test, AutoMockData] [Test, AutoMockData]
@ -119,26 +115,24 @@ public class QualitySizeConfigPhaseTest
Type = "real" Type = "real"
}); });
guide.GetQualitySizeData(default!).ReturnsForAnyArgs(new[] guide.GetQualitySizeData(default!).ReturnsForAnyArgs([
{
new QualitySizeData new QualitySizeData
{ {
Type = "real", Type = "real",
Qualities = new[] Qualities =
{ [
new QualityItem("quality1", 0, 100, 90) new QualityItem("quality1", 0, 100, 90)
} ]
} }
}); ]);
var context = new QualitySizePipelineContext(); var context = new QualitySizePipelineContext();
sut.Execute(context); sut.Execute(context);
context.ConfigOutput.Should().NotBeNull(); context.ConfigOutput.Should().NotBeNull();
context.ConfigOutput!.Qualities.Select(x => x.Item).Should().BeEquivalentTo(new[] context.ConfigOutput!.Qualities.Select(x => x.Item).Should().BeEquivalentTo([
{
new QualityItem("quality1", 0, 100, 90) new QualityItem("quality1", 0, 100, 90)
}); ]);
} }
} }

@ -14,7 +14,7 @@ public class TemplateConfigCreatorTest
ICreateConfigSettings settings, ICreateConfigSettings settings,
TemplateConfigCreator sut) TemplateConfigCreator sut)
{ {
settings.Templates.Returns(new[] {"template1"}); settings.Templates.Returns(["template1"]);
var result = sut.CanHandle(settings); var result = sut.CanHandle(settings);
result.Should().Be(true); result.Should().Be(true);
} }

@ -16,13 +16,12 @@ public class ConfigTemplateListerTest
[Frozen] IConfigTemplateGuideService guideService, [Frozen] IConfigTemplateGuideService guideService,
ConfigListTemplateProcessor sut) ConfigListTemplateProcessor sut)
{ {
guideService.GetTemplateData().Returns(new[] guideService.GetTemplateData().Returns([
{
new TemplatePath {Id = "r1", TemplateFile = stubFile, Service = SupportedServices.Radarr, Hidden = false}, new TemplatePath {Id = "r1", TemplateFile = stubFile, Service = SupportedServices.Radarr, Hidden = false},
new TemplatePath {Id = "r2", TemplateFile = stubFile, Service = SupportedServices.Radarr, Hidden = false}, new TemplatePath {Id = "r2", TemplateFile = stubFile, Service = SupportedServices.Radarr, Hidden = false},
new TemplatePath {Id = "s1", TemplateFile = stubFile, Service = SupportedServices.Sonarr, Hidden = false}, new TemplatePath {Id = "s1", TemplateFile = stubFile, Service = SupportedServices.Sonarr, Hidden = false},
new TemplatePath {Id = "s2", TemplateFile = stubFile, Service = SupportedServices.Sonarr, Hidden = true} new TemplatePath {Id = "s2", TemplateFile = stubFile, Service = SupportedServices.Sonarr, Hidden = true}
}); ]);
var settings = Substitute.For<IConfigListTemplatesSettings>(); var settings = Substitute.For<IConfigListTemplatesSettings>();
settings.Includes.Returns(false); settings.Includes.Returns(false);

@ -29,12 +29,11 @@ public class BulkJsonLoaderIntegrationTest : IntegrationTestFixture
Fs.AddFile(Fs.CurrentDirectory().File("file.json"), new MockFileData(jsonData)); Fs.AddFile(Fs.CurrentDirectory().File("file.json"), new MockFileData(jsonData));
var result = sut.LoadAllFilesAtPaths<TestGuideObject>(new[] {Fs.CurrentDirectory()}); var result = sut.LoadAllFilesAtPaths<TestGuideObject>([Fs.CurrentDirectory()]);
result.Should().BeEquivalentTo(new[] result.Should().BeEquivalentTo([
{
new TestGuideObject("90cedc1fea7ea5d11298bebd3d1d3223", -10000, "TheName") new TestGuideObject("90cedc1fea7ea5d11298bebd3d1d3223", -10000, "TheName")
}); ]);
} }
[Test] [Test]
@ -53,11 +52,10 @@ public class BulkJsonLoaderIntegrationTest : IntegrationTestFixture
Fs.AddFile(Fs.CurrentDirectory().File("file.json"), new MockFileData(jsonData)); Fs.AddFile(Fs.CurrentDirectory().File("file.json"), new MockFileData(jsonData));
var result = sut.LoadAllFilesAtPaths<TestServiceObject>(new[] {Fs.CurrentDirectory()}); var result = sut.LoadAllFilesAtPaths<TestServiceObject>([Fs.CurrentDirectory()]);
result.Should().BeEquivalentTo(new[] result.Should().BeEquivalentTo([
{
new TestServiceObject(22, "FUNi", true) new TestServiceObject(22, "FUNi", true)
}); ]);
} }
} }

@ -25,14 +25,13 @@ public class ConfigurationLoaderEnvVarTest : IntegrationTestFixture
var config = sut.Load(testYml); var config = sut.Load(testYml);
config.Should().BeEquivalentTo(new[] config.Should().BeEquivalentTo([
{
new new
{ {
BaseUrl = new Uri("http://the_url"), BaseUrl = new Uri("http://the_url"),
ApiKey = "the_api_key" ApiKey = "the_api_key"
} }
}); ]);
} }
[Test] [Test]
@ -49,13 +48,12 @@ public class ConfigurationLoaderEnvVarTest : IntegrationTestFixture
"""; """;
var config = sut.Load(testYml); var config = sut.Load(testYml);
config.Should().BeEquivalentTo(new[] config.Should().BeEquivalentTo([
{
new new
{ {
BaseUrl = new Uri("http://sonarr:1233") BaseUrl = new Uri("http://sonarr:1233")
} }
}); ]);
} }
[Test] [Test]
@ -75,13 +73,12 @@ public class ConfigurationLoaderEnvVarTest : IntegrationTestFixture
"""; """;
var config = sut.Load(testYml); var config = sut.Load(testYml);
config.Should().BeEquivalentTo(new[] config.Should().BeEquivalentTo([
{
new new
{ {
BaseUrl = new Uri("http://somevalue") BaseUrl = new Uri("http://somevalue")
} }
}); ]);
} }
[Test] [Test]
@ -101,14 +98,13 @@ public class ConfigurationLoaderEnvVarTest : IntegrationTestFixture
"""; """;
var config = sut.Load(testYml); var config = sut.Load(testYml);
config.Should().BeEquivalentTo(new[] config.Should().BeEquivalentTo([
{
new new
{ {
BaseUrl = new Uri("http://theurl"), BaseUrl = new Uri("http://theurl"),
ApiKey = "the key" ApiKey = "the key"
} }
}); ]);
} }
[Test] [Test]
@ -125,13 +121,12 @@ public class ConfigurationLoaderEnvVarTest : IntegrationTestFixture
"""; """;
var config = sut.Load(testYml); var config = sut.Load(testYml);
config.Should().BeEquivalentTo(new[] config.Should().BeEquivalentTo([
{
new new
{ {
BaseUrl = new Uri("http://somevalue") BaseUrl = new Uri("http://somevalue")
} }
}); ]);
} }
[Test] [Test]
@ -148,13 +143,12 @@ public class ConfigurationLoaderEnvVarTest : IntegrationTestFixture
"""; """;
var config = sut.Load(testYml); var config = sut.Load(testYml);
config.Should().BeEquivalentTo(new[] config.Should().BeEquivalentTo([
{
new new
{ {
BaseUrl = new Uri("http://somevalue") BaseUrl = new Uri("http://somevalue")
} }
}); ]);
} }
[Test] [Test]

@ -23,18 +23,17 @@ public class ConfigurationRegistryTest : IntegrationTestFixture
var result = sut.FindAndLoadConfigs(new ConfigFilterCriteria var result = sut.FindAndLoadConfigs(new ConfigFilterCriteria
{ {
ManualConfigFiles = new[] {"manual.yml"} ManualConfigFiles = ["manual.yml"]
}); });
result.Should().BeEquivalentTo(new[] result.Should().BeEquivalentTo([
{
new RadarrConfiguration new RadarrConfiguration
{ {
BaseUrl = new Uri("http://localhost:7878"), BaseUrl = new Uri("http://localhost:7878"),
ApiKey = "asdf", ApiKey = "asdf",
InstanceName = "instance1" InstanceName = "instance1"
} }
}); ]);
} }
[Test] [Test]
@ -44,7 +43,7 @@ public class ConfigurationRegistryTest : IntegrationTestFixture
var act = () => sut.FindAndLoadConfigs(new ConfigFilterCriteria var act = () => sut.FindAndLoadConfigs(new ConfigFilterCriteria
{ {
ManualConfigFiles = new[] {"manual.yml"} ManualConfigFiles = ["manual.yml"]
}); });
act.Should().ThrowExactly<InvalidConfigurationFilesException>(); act.Should().ThrowExactly<InvalidConfigurationFilesException>();
@ -65,8 +64,8 @@ public class ConfigurationRegistryTest : IntegrationTestFixture
var act = () => sut.FindAndLoadConfigs(new ConfigFilterCriteria var act = () => sut.FindAndLoadConfigs(new ConfigFilterCriteria
{ {
ManualConfigFiles = new[] {"manual.yml"}, ManualConfigFiles = ["manual.yml"],
Instances = new[] {"instance1", "instance2"} Instances = ["instance1", "instance2"]
}); });
act.Should().ThrowExactly<InvalidInstancesException>() act.Should().ThrowExactly<InvalidInstancesException>()
@ -91,7 +90,7 @@ public class ConfigurationRegistryTest : IntegrationTestFixture
var act = () => sut.FindAndLoadConfigs(new ConfigFilterCriteria var act = () => sut.FindAndLoadConfigs(new ConfigFilterCriteria
{ {
ManualConfigFiles = new[] {"manual.yml"} ManualConfigFiles = ["manual.yml"]
}); });
act.Should().ThrowExactly<SplitInstancesException>() act.Should().ThrowExactly<SplitInstancesException>()
@ -127,7 +126,7 @@ public class ConfigurationRegistryTest : IntegrationTestFixture
var act = () => sut.FindAndLoadConfigs(new ConfigFilterCriteria var act = () => sut.FindAndLoadConfigs(new ConfigFilterCriteria
{ {
ManualConfigFiles = new[] {"config1.yml", "config2.yml"} ManualConfigFiles = ["config1.yml", "config2.yml"]
}); });
act.Should().ThrowExactly<DuplicateInstancesException>() act.Should().ThrowExactly<DuplicateInstancesException>()

@ -25,23 +25,21 @@ public class CustomFormatLoaderIntegrationTest : IntegrationTestFixture
Fs.AddFile("collection_of_cfs.md", new MockFileData("")); Fs.AddFile("collection_of_cfs.md", new MockFileData(""));
var dir = Fs.CurrentDirectory(); var dir = Fs.CurrentDirectory();
var results = sut.LoadAllCustomFormatsAtPaths(new[] {dir}, dir.File("collection_of_cfs.md")); var results = sut.LoadAllCustomFormatsAtPaths([dir], dir.File("collection_of_cfs.md"));
results.Should().BeEquivalentTo(new[] results.Should().BeEquivalentTo([
{
NewCf.Data("first", "1"), NewCf.Data("first", "1"),
NewCf.Data("second", "2") NewCf.Data("second", "2")
}, o => o.Excluding(x => x.Type == typeof(JsonElement))); ], o => o.Excluding(x => x.Type == typeof(JsonElement)));
} }
[Test] [Test]
public void Categorize_by_file_name() public void Categorize_by_file_name()
{ {
var categoryParser = Resolve<ICustomFormatCategoryParser>(); var categoryParser = Resolve<ICustomFormatCategoryParser>();
categoryParser.Parse(default!).ReturnsForAnyArgs(new[] categoryParser.Parse(default!).ReturnsForAnyArgs([
{
new CustomFormatCategoryItem("Streaming Services", "iTunes", "iT") new CustomFormatCategoryItem("Streaming Services", "iTunes", "iT")
}); ]);
Fs.AddFile("it.json", new MockFileData("""{"name":"iT"}""")); Fs.AddFile("it.json", new MockFileData("""{"name":"iT"}"""));
Fs.AddEmptyFile("collection_of_cfs.md"); Fs.AddEmptyFile("collection_of_cfs.md");
@ -49,7 +47,7 @@ public class CustomFormatLoaderIntegrationTest : IntegrationTestFixture
var sut = Resolve<CustomFormatLoader>(); var sut = Resolve<CustomFormatLoader>();
var dir = Fs.CurrentDirectory(); var dir = Fs.CurrentDirectory();
var results = sut.LoadAllCustomFormatsAtPaths(new[] {dir}, dir.File("collection_of_cfs.md")); var results = sut.LoadAllCustomFormatsAtPaths([dir], dir.File("collection_of_cfs.md"));
results.Should().ContainSingle().Which.Category.Should().Be("Streaming Services"); results.Should().ContainSingle().Which.Category.Should().Be("Streaming Services");
} }

@ -48,10 +48,10 @@ public class IncludePostProcessorIntegrationTest : IntegrationTestFixture
{ {
["service1"] = new() ["service1"] = new()
{ {
Include = new[] Include =
{ [
new ConfigYamlInclude {Config = configPath.FullName} new ConfigYamlInclude {Config = configPath.FullName}
} ]
} }
} }
}; };
@ -79,10 +79,10 @@ public class IncludePostProcessorIntegrationTest : IntegrationTestFixture
{ {
["service1"] = new() ["service1"] = new()
{ {
Include = new[] Include =
{ [
new ConfigYamlInclude {Config = configPath.FullName} new ConfigYamlInclude {Config = configPath.FullName}
} ]
} }
} }
}; };
@ -129,22 +129,22 @@ public class IncludePostProcessorIntegrationTest : IntegrationTestFixture
{ {
BaseUrl = "the_base_url", BaseUrl = "the_base_url",
ApiKey = "the_api_key", ApiKey = "the_api_key",
CustomFormats = new[] CustomFormats =
{ [
new CustomFormatConfigYaml new CustomFormatConfigYaml
{ {
TrashIds = new[] {"2f22d89048b01681dde8afe203bf2e95"} TrashIds = ["2f22d89048b01681dde8afe203bf2e95"]
} }
}, ],
QualityDefinition = new QualitySizeConfigYaml QualityDefinition = new QualitySizeConfigYaml
{ {
Type = "series" Type = "series"
}, },
Include = new[] Include =
{ [
new ConfigYamlInclude {Config = configPath1.FullName}, new ConfigYamlInclude {Config = configPath1.FullName},
new ConfigYamlInclude {Config = configPath2.FullName} new ConfigYamlInclude {Config = configPath2.FullName}
} ]
} }
} }
}; };
@ -160,24 +160,24 @@ public class IncludePostProcessorIntegrationTest : IntegrationTestFixture
BaseUrl = "the_base_url", BaseUrl = "the_base_url",
ApiKey = "the_api_key", ApiKey = "the_api_key",
Include = null, Include = null,
CustomFormats = new[] CustomFormats =
{ [
new CustomFormatConfigYaml new CustomFormatConfigYaml
{ {
TrashIds = new[] TrashIds =
{ [
"496f355514737f7d83bf7aa4d24f8169", "496f355514737f7d83bf7aa4d24f8169",
"240770601cc226190c367ef59aba7463" "240770601cc226190c367ef59aba7463"
} ]
}, },
new CustomFormatConfigYaml new CustomFormatConfigYaml
{ {
TrashIds = new[] TrashIds =
{ [
"2f22d89048b01681dde8afe203bf2e95" "2f22d89048b01681dde8afe203bf2e95"
} ]
} }
}, ],
QualityDefinition = new QualitySizeConfigYaml QualityDefinition = new QualitySizeConfigYaml
{ {
Type = "series", Type = "series",

@ -16,20 +16,19 @@ public class QualitySizeGuideParserTest : IntegrationTestFixture
var sut = Resolve<QualitySizeGuideParser>(); var sut = Resolve<QualitySizeGuideParser>();
var result = sut.GetQualities(new[] {qualityDir}); var result = sut.GetQualities([qualityDir]);
result.Should().BeEquivalentTo(new[] result.Should().BeEquivalentTo([
{
new QualitySizeData new QualitySizeData
{ {
Type = "series", Type = "series",
Qualities = new[] Qualities =
{ [
new QualityItem("quality1", 1, 2, 3), new QualityItem("quality1", 1, 2, 3),
new QualityItem("quality2", 4.1m, 5.1m, 6.1m) new QualityItem("quality2", 4.1m, 5.1m, 6.1m)
} ]
} }
}); ]);
} }
[Test] [Test]
@ -41,7 +40,7 @@ public class QualitySizeGuideParserTest : IntegrationTestFixture
var sut = Resolve<QualitySizeGuideParser>(); var sut = Resolve<QualitySizeGuideParser>();
var result = sut.GetQualities(new[] {qualityDir}); var result = sut.GetQualities([qualityDir]);
result.Should().BeEmpty(); result.Should().BeEmpty();
} }

@ -39,21 +39,19 @@ public class FileSystemExtensionsTest
[Test] [Test]
public void Merge_directories_works() public void Merge_directories_works()
{ {
var files = FileUtils.NormalizePaths(new[] var files = FileUtils.NormalizePaths([
{
@"path1\1\file1.txt", @"path1\1\file1.txt",
@"path1\1\file2.txt", @"path1\1\file2.txt",
@"path1\1\2\3\4\file3.txt", @"path1\1\2\3\4\file3.txt",
@"path1\file4.txt" @"path1\file4.txt"
}); ]);
var dirs = FileUtils.NormalizePaths(new[] var dirs = FileUtils.NormalizePaths([
{
@"path1\empty1", @"path1\empty1",
@"path1\empty2", @"path1\empty2",
@"path1\1\2\empty3", @"path1\1\2\empty3",
@"path1\1\2\3\4\empty4" @"path1\1\2\3\4\empty4"
}); ]);
var fs = NewMockFileSystem(files, dirs, @"C:\root\path"); var fs = NewMockFileSystem(files, dirs, @"C:\root\path");
@ -70,12 +68,11 @@ public class FileSystemExtensionsTest
[Test] [Test]
public void Fail_if_file_already_exists() public void Fail_if_file_already_exists()
{ {
var files = FileUtils.NormalizePaths(new[] var files = FileUtils.NormalizePaths([
{
@"path1\1\file1.txt", @"path1\1\file1.txt",
@"path1\1\file2.txt", @"path1\1\file2.txt",
@"path2\1\file1.txt" @"path2\1\file1.txt"
}); ]);
var fs = NewMockFileSystem(files, @"C:\root\path"); var fs = NewMockFileSystem(files, @"C:\root\path");
@ -89,15 +86,13 @@ public class FileSystemExtensionsTest
[Test] [Test]
public void Fail_if_directory_exists_where_file_goes() public void Fail_if_directory_exists_where_file_goes()
{ {
var files = FileUtils.NormalizePaths(new[] var files = FileUtils.NormalizePaths([
{
@"path1\1\file1" @"path1\1\file1"
}); ]);
var dirs = FileUtils.NormalizePaths(new[] var dirs = FileUtils.NormalizePaths([
{
@"path2\1\file1" @"path2\1\file1"
}); ]);
var fs = NewMockFileSystem(files, dirs, @"C:\root\path"); var fs = NewMockFileSystem(files, dirs, @"C:\root\path");

@ -20,7 +20,7 @@ public class ConfigExtensionsTest
var invalidInstanceNames = configs.GetInvalidInstanceNames(new ConfigFilterCriteria var invalidInstanceNames = configs.GetInvalidInstanceNames(new ConfigFilterCriteria
{ {
Instances = new[] {"valid_name", "invalid_name"} Instances = ["valid_name", "invalid_name"]
}); });
invalidInstanceNames.Should().BeEquivalentTo("invalid_name"); invalidInstanceNames.Should().BeEquivalentTo("invalid_name");
@ -63,7 +63,7 @@ public class ConfigExtensionsTest
var result = configs.GetConfigsBasedOnSettings(new ConfigFilterCriteria var result = configs.GetConfigsBasedOnSettings(new ConfigFilterCriteria
{ {
Service = SupportedServices.Radarr, Service = SupportedServices.Radarr,
Instances = new[] {"radarr2", "radarr4", "radarr5", "sonarr2"} Instances = ["radarr2", "radarr4", "radarr5", "sonarr2"]
}); });
result.Select(x => x.InstanceName).Should().BeEquivalentTo("radarr2", "radarr4"); result.Select(x => x.InstanceName).Should().BeEquivalentTo("radarr2", "radarr4");

@ -14,10 +14,9 @@ public class ConfigValidationExecutorTest
[Frozen] IRuntimeValidationService validationService, [Frozen] IRuntimeValidationService validationService,
ConfigValidationExecutor sut) ConfigValidationExecutor sut)
{ {
validationService.Validate(default!).ReturnsForAnyArgs(new ValidationResult(new[] validationService.Validate(default!).ReturnsForAnyArgs(new ValidationResult([
{
new ValidationFailure("property", "message") new ValidationFailure("property", "message")
})); ]));
var result = sut.Validate(NewConfig.Radarr()); var result = sut.Validate(NewConfig.Radarr());
@ -29,10 +28,9 @@ public class ConfigValidationExecutorTest
[Frozen] IRuntimeValidationService validationService, [Frozen] IRuntimeValidationService validationService,
ConfigValidationExecutor sut) ConfigValidationExecutor sut)
{ {
validationService.Validate(default!).ReturnsForAnyArgs(new ValidationResult(new[] validationService.Validate(default!).ReturnsForAnyArgs(new ValidationResult([
{
new ValidationFailure("property", "message") {Severity = Severity.Warning} new ValidationFailure("property", "message") {Severity = Severity.Warning}
})); ]));
var result = sut.Validate(NewConfig.Radarr()); var result = sut.Validate(NewConfig.Radarr());

@ -66,10 +66,10 @@ public class ConfigYamlDataObjectsValidationTest
Allowed = true, Allowed = true,
UntilQuality = "Test Quality" UntilQuality = "Test Quality"
}, },
Qualities = new[] Qualities =
{ [
new QualityProfileQualityConfigYaml {Name = "Another Quality"} new QualityProfileQualityConfigYaml {Name = "Another Quality"}
} ]
}; };
var validator = new QualityProfileConfigYamlValidator(); var validator = new QualityProfileConfigYamlValidator();
@ -88,8 +88,8 @@ public class ConfigYamlDataObjectsValidationTest
var data = new QualityProfileConfigYaml var data = new QualityProfileConfigYaml
{ {
Name = "My QP", Name = "My QP",
Qualities = new[] Qualities =
{ [
new QualityProfileQualityConfigYaml {Name = "Dupe Quality"}, new QualityProfileQualityConfigYaml {Name = "Dupe Quality"},
new QualityProfileQualityConfigYaml {Name = "Dupe Quality"}, new QualityProfileQualityConfigYaml {Name = "Dupe Quality"},
new QualityProfileQualityConfigYaml {Name = "Dupe Quality"}, new QualityProfileQualityConfigYaml {Name = "Dupe Quality"},
@ -98,19 +98,19 @@ public class ConfigYamlDataObjectsValidationTest
new QualityProfileQualityConfigYaml new QualityProfileQualityConfigYaml
{ {
Name = "Dupe Quality 2", Name = "Dupe Quality 2",
Qualities = new[] {"Dupe Quality 3"} Qualities = ["Dupe Quality 3"]
}, },
new QualityProfileQualityConfigYaml new QualityProfileQualityConfigYaml
{ {
Name = "Dupe Quality 4", Name = "Dupe Quality 4",
Qualities = new[] {"Dupe Quality 5"} Qualities = ["Dupe Quality 5"]
}, },
new QualityProfileQualityConfigYaml new QualityProfileQualityConfigYaml
{ {
Name = "Dupe Quality 4", Name = "Dupe Quality 4",
Qualities = new[] {"Dupe Quality 5"} Qualities = ["Dupe Quality 5"]
} }
} ]
}; };
var validator = new QualityProfileConfigYamlValidator(); var validator = new QualityProfileConfigYamlValidator();
@ -131,11 +131,11 @@ public class ConfigYamlDataObjectsValidationTest
var data = new QualityProfileConfigYaml var data = new QualityProfileConfigYaml
{ {
Name = "My QP", Name = "My QP",
Qualities = new[] Qualities =
{ [
new QualityProfileQualityConfigYaml {Name = "Quality 1", Enabled = false}, new QualityProfileQualityConfigYaml {Name = "Quality 1", Enabled = false},
new QualityProfileQualityConfigYaml {Name = "Quality 2", Enabled = false} new QualityProfileQualityConfigYaml {Name = "Quality 2", Enabled = false}
} ]
}; };
var validator = new QualityProfileConfigYamlValidator(); var validator = new QualityProfileConfigYamlValidator();
@ -158,11 +158,11 @@ public class ConfigYamlDataObjectsValidationTest
Allowed = true, Allowed = true,
UntilQuality = "Disabled Quality" UntilQuality = "Disabled Quality"
}, },
Qualities = new[] Qualities =
{ [
new QualityProfileQualityConfigYaml {Name = "Enabled Quality"}, new QualityProfileQualityConfigYaml {Name = "Enabled Quality"},
new QualityProfileQualityConfigYaml {Name = "Disabled Quality", Enabled = false} new QualityProfileQualityConfigYaml {Name = "Disabled Quality", Enabled = false}
} ]
}; };
var validator = new QualityProfileConfigYamlValidator(); var validator = new QualityProfileConfigYamlValidator();
@ -180,14 +180,14 @@ public class ConfigYamlDataObjectsValidationTest
var data = new QualityProfileConfigYaml var data = new QualityProfileConfigYaml
{ {
Name = "Profile", Name = "Profile",
Qualities = new[] Qualities =
{ [
new QualityProfileQualityConfigYaml new QualityProfileQualityConfigYaml
{ {
Name = "Group", Name = "Group",
Qualities = Array.Empty<string>() Qualities = Array.Empty<string>()
} }
} ]
}; };
var validator = new QualityProfileConfigYamlValidator(); var validator = new QualityProfileConfigYamlValidator();
@ -205,17 +205,17 @@ public class ConfigYamlDataObjectsValidationTest
var data = new QualityProfileConfigYaml var data = new QualityProfileConfigYaml
{ {
Name = "Profile", Name = "Profile",
Qualities = new[] Qualities =
{ [
new QualityProfileQualityConfigYaml new QualityProfileQualityConfigYaml
{ {
Name = "Group", Name = "Group",
Qualities = new[] Qualities =
{ [
"One Quality" "One Quality"
} ]
} }
} ]
}; };
var validator = new QualityProfileConfigYamlValidator(); var validator = new QualityProfileConfigYamlValidator();
@ -233,18 +233,18 @@ public class ConfigYamlDataObjectsValidationTest
var data = new QualityProfileConfigYaml var data = new QualityProfileConfigYaml
{ {
Name = "Profile", Name = "Profile",
Qualities = new[] Qualities =
{ [
new QualityProfileQualityConfigYaml new QualityProfileQualityConfigYaml
{ {
Name = "Group", Name = "Group",
Qualities = new[] Qualities =
{ [
"One Quality", "One Quality",
"Two Quality" "Two Quality"
} ]
} }
} ]
}; };
var validator = new QualityProfileConfigYamlValidator(); var validator = new QualityProfileConfigYamlValidator();

@ -11,17 +11,17 @@ public class MergeCustomFormatsTest
{ {
var leftConfig = new SonarrConfigYaml var leftConfig = new SonarrConfigYaml
{ {
CustomFormats = new[] CustomFormats =
{ [
new CustomFormatConfigYaml new CustomFormatConfigYaml
{ {
TrashIds = new[] {"id1", "id2"}, TrashIds = ["id1", "id2"],
AssignScoresTo = new[] AssignScoresTo =
{ [
new QualityScoreConfigYaml {Name = "c", Score = 100} new QualityScoreConfigYaml {Name = "c", Score = 100}
} ]
} }
} ]
}; };
var rightConfig = new SonarrConfigYaml(); var rightConfig = new SonarrConfigYaml();
@ -40,17 +40,17 @@ public class MergeCustomFormatsTest
var rightConfig = new SonarrConfigYaml var rightConfig = new SonarrConfigYaml
{ {
CustomFormats = new[] CustomFormats =
{ [
new CustomFormatConfigYaml new CustomFormatConfigYaml
{ {
TrashIds = new[] {"id1", "id2"}, TrashIds = ["id1", "id2"],
AssignScoresTo = new[] AssignScoresTo =
{ [
new QualityScoreConfigYaml {Name = "c", Score = 100} new QualityScoreConfigYaml {Name = "c", Score = 100}
} ]
} }
} ]
}; };
var sut = new SonarrConfigMerger(); var sut = new SonarrConfigMerger();
@ -65,58 +65,58 @@ public class MergeCustomFormatsTest
{ {
var leftConfig = new SonarrConfigYaml var leftConfig = new SonarrConfigYaml
{ {
CustomFormats = new[] CustomFormats =
{ [
new CustomFormatConfigYaml new CustomFormatConfigYaml
{ {
TrashIds = new[] {"id1", "id2"}, TrashIds = ["id1", "id2"],
AssignScoresTo = new[] AssignScoresTo =
{ [
new QualityScoreConfigYaml {Name = "c", Score = 100}, new QualityScoreConfigYaml {Name = "c", Score = 100},
new QualityScoreConfigYaml {Name = "d", Score = 101}, new QualityScoreConfigYaml {Name = "d", Score = 101},
new QualityScoreConfigYaml {Name = "e", Score = 102} new QualityScoreConfigYaml {Name = "e", Score = 102}
} ]
}, },
new CustomFormatConfigYaml new CustomFormatConfigYaml
{ {
TrashIds = new[] {"id2"}, TrashIds = ["id2"],
AssignScoresTo = new[] AssignScoresTo =
{ [
new QualityScoreConfigYaml {Name = "f", Score = 100} new QualityScoreConfigYaml {Name = "f", Score = 100}
} ]
} }
} ]
}; };
var rightConfig = new SonarrConfigYaml var rightConfig = new SonarrConfigYaml
{ {
CustomFormats = new[] CustomFormats =
{ [
new CustomFormatConfigYaml new CustomFormatConfigYaml
{ {
TrashIds = new[] {"id3", "id4"}, TrashIds = ["id3", "id4"],
AssignScoresTo = new[] AssignScoresTo =
{ [
new QualityScoreConfigYaml {Name = "d", Score = 200} new QualityScoreConfigYaml {Name = "d", Score = 200}
} ]
}, },
new CustomFormatConfigYaml new CustomFormatConfigYaml
{ {
TrashIds = new[] {"id5", "id6"}, TrashIds = ["id5", "id6"],
AssignScoresTo = new[] AssignScoresTo =
{ [
new QualityScoreConfigYaml {Name = "e", Score = 300} new QualityScoreConfigYaml {Name = "e", Score = 300}
} ]
}, },
new CustomFormatConfigYaml new CustomFormatConfigYaml
{ {
TrashIds = new[] {"id1"}, TrashIds = ["id1"],
AssignScoresTo = new[] AssignScoresTo =
{ [
new QualityScoreConfigYaml {Name = "c", Score = 50} new QualityScoreConfigYaml {Name = "c", Score = 50}
} ]
} }
} ]
}; };
var sut = new SonarrConfigMerger(); var sut = new SonarrConfigMerger();
@ -125,65 +125,65 @@ public class MergeCustomFormatsTest
result.Should().BeEquivalentTo(new SonarrConfigYaml result.Should().BeEquivalentTo(new SonarrConfigYaml
{ {
CustomFormats = new[] CustomFormats =
{ [
new CustomFormatConfigYaml new CustomFormatConfigYaml
{ {
TrashIds = new[] {"id2"}, TrashIds = ["id2"],
AssignScoresTo = new[] AssignScoresTo =
{ [
new QualityScoreConfigYaml {Name = "c", Score = 100} new QualityScoreConfigYaml {Name = "c", Score = 100}
} ]
}, },
new CustomFormatConfigYaml new CustomFormatConfigYaml
{ {
TrashIds = new[] {"id1", "id2"}, TrashIds = ["id1", "id2"],
AssignScoresTo = new[] AssignScoresTo =
{ [
new QualityScoreConfigYaml {Name = "d", Score = 101} new QualityScoreConfigYaml {Name = "d", Score = 101}
} ]
}, },
new CustomFormatConfigYaml new CustomFormatConfigYaml
{ {
TrashIds = new[] {"id1", "id2"}, TrashIds = ["id1", "id2"],
AssignScoresTo = new[] AssignScoresTo =
{ [
new QualityScoreConfigYaml {Name = "e", Score = 102} new QualityScoreConfigYaml {Name = "e", Score = 102}
} ]
}, },
new CustomFormatConfigYaml new CustomFormatConfigYaml
{ {
TrashIds = new[] {"id2"}, TrashIds = ["id2"],
AssignScoresTo = new[] AssignScoresTo =
{ [
new QualityScoreConfigYaml {Name = "f", Score = 100} new QualityScoreConfigYaml {Name = "f", Score = 100}
} ]
}, },
new CustomFormatConfigYaml new CustomFormatConfigYaml
{ {
TrashIds = new[] {"id3", "id4"}, TrashIds = ["id3", "id4"],
AssignScoresTo = new[] AssignScoresTo =
{ [
new QualityScoreConfigYaml {Name = "d", Score = 200} new QualityScoreConfigYaml {Name = "d", Score = 200}
} ]
}, },
new CustomFormatConfigYaml new CustomFormatConfigYaml
{ {
TrashIds = new[] {"id5", "id6"}, TrashIds = ["id5", "id6"],
AssignScoresTo = new[] AssignScoresTo =
{ [
new QualityScoreConfigYaml {Name = "e", Score = 300} new QualityScoreConfigYaml {Name = "e", Score = 300}
} ]
}, },
new CustomFormatConfigYaml new CustomFormatConfigYaml
{ {
TrashIds = new[] {"id1"}, TrashIds = ["id1"],
AssignScoresTo = new[] AssignScoresTo =
{ [
new QualityScoreConfigYaml {Name = "c", Score = 50} new QualityScoreConfigYaml {Name = "c", Score = 50}
} ]
} }
} ]
}); });
} }
} }

@ -13,8 +13,8 @@ public class MergeQualityProfilesTest
{ {
var leftConfig = new SonarrConfigYaml var leftConfig = new SonarrConfigYaml
{ {
QualityProfiles = new[] QualityProfiles =
{ [
new QualityProfileConfigYaml new QualityProfileConfigYaml
{ {
Name = "e", Name = "e",
@ -24,7 +24,7 @@ public class MergeQualityProfilesTest
ResetUnmatchedScores = new ResetUnmatchedScoresConfigYaml ResetUnmatchedScores = new ResetUnmatchedScoresConfigYaml
{ {
Enabled = true, Enabled = true,
Except = new[] {"except1"} Except = ["except1"]
}, },
Upgrade = new QualityProfileFormatUpgradeYaml Upgrade = new QualityProfileFormatUpgradeYaml
{ {
@ -32,17 +32,17 @@ public class MergeQualityProfilesTest
UntilQuality = "quality1", UntilQuality = "quality1",
UntilScore = 200 UntilScore = 200
}, },
Qualities = new[] Qualities =
{ [
new QualityProfileQualityConfigYaml new QualityProfileQualityConfigYaml
{ {
Enabled = true, Enabled = true,
Name = "quality1", Name = "quality1",
Qualities = new[] {"quality"} Qualities = ["quality"]
} }
} ]
} }
} ]
}; };
var rightConfig = new SonarrConfigYaml(); var rightConfig = new SonarrConfigYaml();
@ -61,8 +61,8 @@ public class MergeQualityProfilesTest
var rightConfig = new SonarrConfigYaml var rightConfig = new SonarrConfigYaml
{ {
QualityProfiles = new[] QualityProfiles =
{ [
new QualityProfileConfigYaml new QualityProfileConfigYaml
{ {
Name = "e", Name = "e",
@ -72,7 +72,7 @@ public class MergeQualityProfilesTest
ResetUnmatchedScores = new ResetUnmatchedScoresConfigYaml ResetUnmatchedScores = new ResetUnmatchedScoresConfigYaml
{ {
Enabled = true, Enabled = true,
Except = new[] {"except1"} Except = ["except1"]
}, },
Upgrade = new QualityProfileFormatUpgradeYaml Upgrade = new QualityProfileFormatUpgradeYaml
{ {
@ -80,17 +80,17 @@ public class MergeQualityProfilesTest
UntilQuality = "quality1", UntilQuality = "quality1",
UntilScore = 200 UntilScore = 200
}, },
Qualities = new[] Qualities =
{ [
new QualityProfileQualityConfigYaml new QualityProfileQualityConfigYaml
{ {
Enabled = true, Enabled = true,
Name = "quality1", Name = "quality1",
Qualities = new[] {"quality"} Qualities = ["quality"]
} }
} ]
} }
} ]
}; };
var sut = new SonarrConfigMerger(); var sut = new SonarrConfigMerger();
@ -106,8 +106,8 @@ public class MergeQualityProfilesTest
{ {
var leftConfig = new SonarrConfigYaml var leftConfig = new SonarrConfigYaml
{ {
QualityProfiles = new[] QualityProfiles =
{ [
new QualityProfileConfigYaml new QualityProfileConfigYaml
{ {
Name = "e", Name = "e",
@ -117,7 +117,7 @@ public class MergeQualityProfilesTest
ResetUnmatchedScores = new ResetUnmatchedScoresConfigYaml ResetUnmatchedScores = new ResetUnmatchedScoresConfigYaml
{ {
Enabled = true, Enabled = true,
Except = new[] {"except1"} Except = ["except1"]
}, },
Upgrade = new QualityProfileFormatUpgradeYaml Upgrade = new QualityProfileFormatUpgradeYaml
{ {
@ -125,52 +125,52 @@ public class MergeQualityProfilesTest
UntilQuality = "quality1", UntilQuality = "quality1",
UntilScore = 200 UntilScore = 200
}, },
Qualities = new[] Qualities =
{ [
new QualityProfileQualityConfigYaml new QualityProfileQualityConfigYaml
{ {
Enabled = true, Enabled = true,
Name = "quality1", Name = "quality1",
Qualities = new[] {"quality"} Qualities = ["quality"]
} }
} ]
} }
} ]
}; };
var rightConfig = new SonarrConfigYaml var rightConfig = new SonarrConfigYaml
{ {
QualityProfiles = new[] QualityProfiles =
{ [
new QualityProfileConfigYaml new QualityProfileConfigYaml
{ {
Name = "e", Name = "e",
ScoreSet = "set2", ScoreSet = "set2",
ResetUnmatchedScores = new ResetUnmatchedScoresConfigYaml ResetUnmatchedScores = new ResetUnmatchedScoresConfigYaml
{ {
Except = new[] {"except2", "except3"} Except = ["except2", "except3"]
}, },
Upgrade = new QualityProfileFormatUpgradeYaml Upgrade = new QualityProfileFormatUpgradeYaml
{ {
UntilQuality = "quality2" UntilQuality = "quality2"
}, },
Qualities = new[] Qualities =
{ [
new QualityProfileQualityConfigYaml new QualityProfileQualityConfigYaml
{ {
Enabled = false, Enabled = false,
Name = "quality2", Name = "quality2",
Qualities = new[] {"quality3"} Qualities = ["quality3"]
}, },
new QualityProfileQualityConfigYaml new QualityProfileQualityConfigYaml
{ {
Enabled = true, Enabled = true,
Name = "quality4", Name = "quality4",
Qualities = new[] {"quality5", "quality6"} Qualities = ["quality5", "quality6"]
} }
} ]
} }
} ]
}; };
var sut = new SonarrConfigMerger(); var sut = new SonarrConfigMerger();
@ -179,8 +179,8 @@ public class MergeQualityProfilesTest
result.Should().BeEquivalentTo(new SonarrConfigYaml result.Should().BeEquivalentTo(new SonarrConfigYaml
{ {
QualityProfiles = new[] QualityProfiles =
{ [
new QualityProfileConfigYaml new QualityProfileConfigYaml
{ {
Name = "e", Name = "e",
@ -190,7 +190,7 @@ public class MergeQualityProfilesTest
ResetUnmatchedScores = new ResetUnmatchedScoresConfigYaml ResetUnmatchedScores = new ResetUnmatchedScoresConfigYaml
{ {
Enabled = true, Enabled = true,
Except = new[] {"except1", "except2", "except3"} Except = ["except1", "except2", "except3"]
}, },
Upgrade = new QualityProfileFormatUpgradeYaml Upgrade = new QualityProfileFormatUpgradeYaml
{ {
@ -198,23 +198,23 @@ public class MergeQualityProfilesTest
UntilQuality = "quality2", UntilQuality = "quality2",
UntilScore = 200 UntilScore = 200
}, },
Qualities = new[] Qualities =
{ [
new QualityProfileQualityConfigYaml new QualityProfileQualityConfigYaml
{ {
Enabled = false, Enabled = false,
Name = "quality2", Name = "quality2",
Qualities = new[] {"quality3"} Qualities = ["quality3"]
}, },
new QualityProfileQualityConfigYaml new QualityProfileQualityConfigYaml
{ {
Enabled = true, Enabled = true,
Name = "quality4", Name = "quality4",
Qualities = new[] {"quality5", "quality6"} Qualities = ["quality5", "quality6"]
} }
} ]
} }
} ]
}); });
} }
} }

@ -14,15 +14,14 @@ public class TemplateIncludeProcessorTest
TemplateIncludeProcessor sut) TemplateIncludeProcessor sut)
{ {
var templatePath = fs.CurrentDirectory().File("some/path/template.yml"); var templatePath = fs.CurrentDirectory().File("some/path/template.yml");
templates.GetIncludeData().Returns(new[] templates.GetIncludeData().Returns([
{
new TemplatePath new TemplatePath
{ {
Id = "my-template", Id = "my-template",
Service = SupportedServices.Radarr, Service = SupportedServices.Radarr,
TemplateFile = templatePath TemplateFile = templatePath
} }
}); ]);
var includeDirective = new TemplateYamlInclude {Template = "my-template"}; var includeDirective = new TemplateYamlInclude {Template = "my-template"};
@ -49,15 +48,14 @@ public class TemplateIncludeProcessorTest
TemplateIncludeProcessor sut) TemplateIncludeProcessor sut)
{ {
var templatePath = fs.CurrentDirectory().File("some/path/template.yml"); var templatePath = fs.CurrentDirectory().File("some/path/template.yml");
templates.GetIncludeData().Returns(new[] templates.GetIncludeData().Returns([
{
new TemplatePath new TemplatePath
{ {
Id = "my-template", Id = "my-template",
Service = SupportedServices.Radarr, Service = SupportedServices.Radarr,
TemplateFile = templatePath TemplateFile = templatePath
} }
}); ]);
var includeDirective = new TemplateYamlInclude {Template = "my-template"}; var includeDirective = new TemplateYamlInclude {Template = "my-template"};
@ -73,15 +71,14 @@ public class TemplateIncludeProcessorTest
TemplateIncludeProcessor sut) TemplateIncludeProcessor sut)
{ {
var templatePath = fs.CurrentDirectory().File("some/path/template.yml"); var templatePath = fs.CurrentDirectory().File("some/path/template.yml");
templates.GetIncludeData().Returns(new[] templates.GetIncludeData().Returns([
{
new TemplatePath new TemplatePath
{ {
Id = "my-template", Id = "my-template",
Service = SupportedServices.Radarr, Service = SupportedServices.Radarr,
TemplateFile = templatePath TemplateFile = templatePath
} }
}); ]);
var includeDirective = new TemplateYamlInclude {Template = "template-does-not-exist"}; var includeDirective = new TemplateYamlInclude {Template = "template-does-not-exist"};

@ -51,7 +51,7 @@ public class YamlConfigValidatorTest
{ {
new() new()
{ {
TrashIds = new[] {"valid"}, TrashIds = ["valid"],
AssignScoresTo = new List<QualityScoreConfigYaml> AssignScoresTo = new List<QualityScoreConfigYaml>
{ {
new() new()
@ -84,7 +84,7 @@ public class YamlConfigValidatorTest
{ {
new() new()
{ {
TrashIds = new[] {"valid"}, TrashIds = ["valid"],
AssignScoresTo = new List<QualityScoreConfigYaml> AssignScoresTo = new List<QualityScoreConfigYaml>
{ {
new() new()
@ -118,7 +118,7 @@ public class YamlConfigValidatorTest
{ {
new() new()
{ {
TrashIds = new[] {"valid"}, TrashIds = ["valid"],
AssignScoresTo = new List<QualityScoreConfigYaml> AssignScoresTo = new List<QualityScoreConfigYaml>
{ {
new() new()

@ -15,7 +15,7 @@ public class JsonUtilsTest
var path = fs.CurrentDirectory().SubDirectory("doesnt_exist"); var path = fs.CurrentDirectory().SubDirectory("doesnt_exist");
var result = JsonUtils.GetJsonFilesInDirectories(new[] {path}, log); var result = JsonUtils.GetJsonFilesInDirectories([path], log);
result.Should().BeEmpty(); result.Should().BeEmpty();
log.Messages.Should().ContainSingle() log.Messages.Should().ContainSingle()
@ -31,7 +31,7 @@ public class JsonUtilsTest
var path = fs.CurrentDirectory().SubDirectory("exists").File("test.json"); var path = fs.CurrentDirectory().SubDirectory("exists").File("test.json");
fs.AddFile(path.FullName, new MockFileData("")); fs.AddFile(path.FullName, new MockFileData(""));
var result = JsonUtils.GetJsonFilesInDirectories(new[] {path.Directory}, log); var result = JsonUtils.GetJsonFilesInDirectories([path.Directory], log);
result.Should().ContainSingle() result.Should().ContainSingle()
.Which.FullName .Which.FullName
@ -70,7 +70,7 @@ public class JsonUtilsTest
public void Null_paths_are_ignored() public void Null_paths_are_ignored()
{ {
var result = JsonUtils.GetJsonFilesInDirectories( var result = JsonUtils.GetJsonFilesInDirectories(
new IDirectoryInfo?[] {null, null}, [null, null],
Substitute.For<ILogger>()); Substitute.For<ILogger>());
result.Should().BeEmpty(); result.Should().BeEmpty();

@ -67,8 +67,7 @@ public class CustomFormatCategoryParserTest
); );
result.Where(x => x.CategoryName == "Audio Advanced #1").Select(x => (x.CfName, x.CfAnchor)) result.Where(x => x.CategoryName == "Audio Advanced #1").Select(x => (x.CfName, x.CfAnchor))
.Should().BeEquivalentTo(new[] .Should().BeEquivalentTo([
{
("TrueHD ATMOS", "truehd-atmos"), ("TrueHD ATMOS", "truehd-atmos"),
("DTS X", "dts-x"), ("DTS X", "dts-x"),
("ATMOS (undefined)", "atmos-undefined"), ("ATMOS (undefined)", "atmos-undefined"),
@ -78,11 +77,10 @@ public class CustomFormatCategoryParserTest
("DD+", "ddplus"), ("DD+", "ddplus"),
("DTS-ES", "dts-es"), ("DTS-ES", "dts-es"),
("DTS", "dts") ("DTS", "dts")
}); ]);
result.Where(x => x.CategoryName == "Anime").Select(x => (x.CfName, x.CfAnchor)) result.Where(x => x.CategoryName == "Anime").Select(x => (x.CfName, x.CfAnchor))
.Should().BeEquivalentTo(new[] .Should().BeEquivalentTo([
{
("Anime Web Tier 01 (Muxers)", "anime-web-tier-01-muxers"), ("Anime Web Tier 01 (Muxers)", "anime-web-tier-01-muxers"),
("Anime Web Tier 02 (Top FanSubs)", "anime-web-tier-02-top-fansubs"), ("Anime Web Tier 02 (Top FanSubs)", "anime-web-tier-02-top-fansubs"),
("Anime Web Tier 03 (Official Subs)", "anime-web-tier-03-official-subs"), ("Anime Web Tier 03 (Official Subs)", "anime-web-tier-03-official-subs"),
@ -97,6 +95,6 @@ public class CustomFormatCategoryParserTest
("v3", "v3"), ("v3", "v3"),
("v4", "v4"), ("v4", "v4"),
("VRV", "vrv") ("VRV", "vrv")
}); ]);
} }
} }

Loading…
Cancel
Save