From 2241c57203d36c6e55a26869b64c94a11ec00861 Mon Sep 17 00:00:00 2001 From: Julian Lechner Date: Mon, 23 Nov 2026 10:20:59 +0100 Subject: [PATCH] feat: add ad and moderator placeholder content Add AdSpot and ModeratorSegment models with Title and Duration and a read-only in-memory seed list for each in PlaceholderContent. Ads and moderator talk are placeholders without audio, so no database table is needed. Lengths vary (ads 30 s to 2 min, moderator 30 s to 3 min) so the schedule generator can size these segments to end songs exactly before the news. Tests check the lists are non-empty with titles and positive durations. Refs #7 Co-Authored-By: Claude Opus 5.5 --- src/Radiosender/Models/AdSpot.cs | 4 +++ src/Radiosender/Models/ModeratorSegment.cs | 4 +++ .../Services/PlaceholderContent.cs | 27 ++++++++++++++++++ .../PlaceholderContentTests.cs | 28 +++++++++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 src/Radiosender/Models/AdSpot.cs create mode 100644 src/Radiosender/Models/ModeratorSegment.cs create mode 100644 src/Radiosender/Services/PlaceholderContent.cs create mode 100644 tests/Radiosender.Tests/PlaceholderContentTests.cs diff --git a/src/Radiosender/Models/AdSpot.cs b/src/Radiosender/Models/AdSpot.cs new file mode 100644 index 0000000..4efb655 --- /dev/null +++ b/src/Radiosender/Models/AdSpot.cs @@ -0,0 +1,4 @@ +namespace Radiosender.Models; + +// Placeholder without audio: the schedule only needs a title and a length. +public record AdSpot(string Title, TimeSpan Duration); diff --git a/src/Radiosender/Models/ModeratorSegment.cs b/src/Radiosender/Models/ModeratorSegment.cs new file mode 100644 index 0000000..9784107 --- /dev/null +++ b/src/Radiosender/Models/ModeratorSegment.cs @@ -0,0 +1,4 @@ +namespace Radiosender.Models; + +// Placeholder without audio: the schedule only needs a title and a length. +public record ModeratorSegment(string Title, TimeSpan Duration); diff --git a/src/Radiosender/Services/PlaceholderContent.cs b/src/Radiosender/Services/PlaceholderContent.cs new file mode 100644 index 0000000..45235b9 --- /dev/null +++ b/src/Radiosender/Services/PlaceholderContent.cs @@ -0,0 +1,27 @@ +using Radiosender.Models; + +namespace Radiosender.Services; + +// In-memory seed data; varied lengths let the schedule generator fill gaps before the news. +public static class PlaceholderContent +{ + public static IReadOnlyList AdSpots { get; } = + [ + new("Bakery Sonnenschein", TimeSpan.FromSeconds(30)), + new("Autohaus Berger", TimeSpan.FromSeconds(45)), + new("Stadtwerke Energy Tips", TimeSpan.FromSeconds(60)), + new("Furniture Outlet Sale", TimeSpan.FromSeconds(75)), + new("Regional Bank Savings", TimeSpan.FromSeconds(90)), + new("Summer Festival Preview", TimeSpan.FromMinutes(2)), + ]; + + public static IReadOnlyList ModeratorSegments { get; } = + [ + new("Station ID", TimeSpan.FromSeconds(30)), + new("Weather Update", TimeSpan.FromSeconds(60)), + new("Traffic Report", TimeSpan.FromSeconds(90)), + new("Song Introduction", TimeSpan.FromMinutes(2)), + new("Local Events", TimeSpan.FromSeconds(150)), + new("Listener Greetings", TimeSpan.FromMinutes(3)), + ]; +} diff --git a/tests/Radiosender.Tests/PlaceholderContentTests.cs b/tests/Radiosender.Tests/PlaceholderContentTests.cs new file mode 100644 index 0000000..33b4984 --- /dev/null +++ b/tests/Radiosender.Tests/PlaceholderContentTests.cs @@ -0,0 +1,28 @@ +using Radiosender.Services; + +namespace Radiosender.Tests; + +public class PlaceholderContentTests +{ + [Fact] + public void AdSpots_AreNonEmptyWithTitlesAndPositiveDurations() + { + Assert.NotEmpty(PlaceholderContent.AdSpots); + Assert.All(PlaceholderContent.AdSpots, ad => + { + Assert.False(string.IsNullOrWhiteSpace(ad.Title)); + Assert.True(ad.Duration > TimeSpan.Zero); + }); + } + + [Fact] + public void ModeratorSegments_AreNonEmptyWithTitlesAndPositiveDurations() + { + Assert.NotEmpty(PlaceholderContent.ModeratorSegments); + Assert.All(PlaceholderContent.ModeratorSegments, segment => + { + Assert.False(string.IsNullOrWhiteSpace(segment.Title)); + Assert.True(segment.Duration > TimeSpan.Zero); + }); + } +}