You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
recyclarr/src/tests/Recyclarr.Cli.TestLibrary/NewQp.cs

56 lines
1.7 KiB

using Recyclarr.Cli.Pipelines.QualityProfile;
using Recyclarr.Cli.Pipelines.QualityProfile.Api;
using Recyclarr.Cli.Pipelines.QualityProfile.PipelinePhases;
using Recyclarr.TrashLib.Config.Services;
namespace Recyclarr.Cli.TestLibrary;
public static class NewQp
{
public static ProcessedQualityProfileData Processed(
string profileName,
params (string TrashId, int FormatId, int Score)[] scores)
{
return Processed(profileName, false, scores);
}
public static ProcessedQualityProfileData Processed(
string profileName,
bool resetUnmatchedScores,
params (string TrashId, int FormatId, int Score)[] scores)
{
return Processed(profileName, resetUnmatchedScores,
scores.Select(x => ("", x.TrashId, x.FormatId, x.Score)).ToArray());
}
public static ProcessedQualityProfileData Processed(
string profileName,
bool resetUnmatchedScores,
params (string CfName, string TrashId, int FormatId, int Score)[] scores)
{
return new ProcessedQualityProfileData(new QualityProfileConfig
{
Name = profileName, ResetUnmatchedScores = resetUnmatchedScores
})
{
CfScores = scores
.Select(x => new ProcessedQualityProfileScore(x.TrashId, x.CfName, x.FormatId, x.Score))
.ToList()
};
}
public static UpdatedFormatScore UpdatedScore(
string name,
int oldScore,
int newScore,
FormatScoreUpdateReason reason)
{
return new UpdatedFormatScore
{
Dto = new ProfileFormatItemDto {Name = name, Score = oldScore},
NewScore = newScore,
Reason = reason
};
}
}