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