Implement BumperEndpoints and remove deprecated bumper-related functionality
Added new BumperEndpoints to the API for managing bumper templates and variants, enhancing the channel management capabilities. Removed outdated bumper-related commands and handlers from the application, streamlining the codebase and improving maintainability. Updated ChannelEndpoints to reflect these changes and ensure proper routing for the new endpoints.
This commit is contained in:
@@ -11,44 +11,57 @@ namespace TeleWave.Application.Tests.Validators;
|
||||
public class ValidatorTests
|
||||
{
|
||||
[Fact]
|
||||
public void UpdateBumperTextVariant_ChecksLengthsAndWeight()
|
||||
public void UpdateBumperVariant_ChecksNameWeightAndLines()
|
||||
{
|
||||
var v = new UpdateBumperTextVariantCommandValidator();
|
||||
var v = new UpdateBumperVariantCommandValidator();
|
||||
|
||||
var good = new UpdateBumperTextVariantCommand(
|
||||
var good = new UpdateBumperVariantCommand(
|
||||
Guid.NewGuid(),
|
||||
Guid.NewGuid(),
|
||||
Guid.NewGuid(),
|
||||
"Name",
|
||||
BumperTextKind.NowNext,
|
||||
"NOW",
|
||||
"NEXT",
|
||||
"l1",
|
||||
"l2",
|
||||
BumperTrigger.Both,
|
||||
3
|
||||
new BumperVariantInput(
|
||||
"Name",
|
||||
BumperTrigger.Both,
|
||||
BumperBackground.NextPoster,
|
||||
3,
|
||||
[new BumperLineDto(BumperLineStyle.Title, BumperLineColor.Text, "{next.title}")]
|
||||
)
|
||||
);
|
||||
Assert.True(v.Validate(good).IsValid);
|
||||
|
||||
Assert.False(v.Validate(good with { Name = "" }).IsValid);
|
||||
Assert.False(v.Validate(good with { Weight = -1 }).IsValid);
|
||||
Assert.False(v.Validate(good with { Line1 = new string('x', 121) }).IsValid);
|
||||
Assert.False(v.Validate(Patch(good, input => input with { Name = "" })).IsValid);
|
||||
Assert.False(v.Validate(Patch(good, input => input with { Weight = -1 })).IsValid);
|
||||
Assert.False(
|
||||
v.Validate(
|
||||
Patch(
|
||||
good,
|
||||
input =>
|
||||
input with
|
||||
{
|
||||
Lines =
|
||||
[
|
||||
new BumperLineDto(
|
||||
BumperLineStyle.Title,
|
||||
BumperLineColor.Text,
|
||||
new string('x', 121)
|
||||
),
|
||||
],
|
||||
}
|
||||
)
|
||||
).IsValid
|
||||
);
|
||||
}
|
||||
|
||||
private static UpdateBumperVariantCommand Patch(
|
||||
UpdateBumperVariantCommand command,
|
||||
Func<BumperVariantInput, BumperVariantInput> change
|
||||
) => command with { Input = change(command.Input) };
|
||||
|
||||
[Fact]
|
||||
public void UpdateChannelSettings_ChecksRanges()
|
||||
{
|
||||
var v = new UpdateChannelSettingsCommandValidator();
|
||||
var bumper = new BumperSettingsInput(BumperFont.Sans, BumperSelection.WeightedRandom);
|
||||
|
||||
var good = new UpdateChannelSettingsCommand(
|
||||
Guid.NewGuid(),
|
||||
"Name",
|
||||
true,
|
||||
true,
|
||||
bumper,
|
||||
null
|
||||
);
|
||||
var good = new UpdateChannelSettingsCommand(Guid.NewGuid(), "Name", true, null);
|
||||
Assert.True(v.Validate(good).IsValid);
|
||||
|
||||
Assert.False(v.Validate(good with { Name = "" }).IsValid);
|
||||
|
||||
Reference in New Issue
Block a user