[TestCase(9, false, ExpectedResult = 9, TestName = "Index at the grouped count, nothing grouped")]
@ -47,8 +39,7 @@ public class AlternateScheduleAnchorTests : PlayoutBuilderTestBase
@@ -47,8 +39,7 @@ public class AlternateScheduleAnchorTests : PlayoutBuilderTestBase
@ -468,8 +468,7 @@ public class ContinuePlayoutTests : PlayoutBuilderTestBase
@@ -468,8 +468,7 @@ public class ContinuePlayoutTests : PlayoutBuilderTestBase
result.AddedItems.Count.ShouldBe(53);
}
// two collections, each with a checkpoint for the two midnights the build crossed
// plus a continue anchor
// two collections, each with a continue anchor and a checkpoint per midnight crossed
@ -25,13 +22,11 @@ public class MultiDayBuildTests : PlayoutBuilderTestBase
@@ -25,13 +22,11 @@ public class MultiDayBuildTests : PlayoutBuilderTestBase
// a playout created at 20:00, then built every hour for a week
DateTimeOffsetstart=LocalTime(20);
varmissing=newList<string>();
@ -48,15 +43,13 @@ public class MultiDayBuildTests : PlayoutBuilderTestBase
@@ -48,15 +43,13 @@ public class MultiDayBuildTests : PlayoutBuilderTestBase
result.IsRight.ShouldBeTrue($"build failed at {now:yyyy-MM-dd HH:mm}");
// a build never writes a checkpoint for its own first day, and doesn't need to:
// there is no earlier state to restore, so refreshing starts from index 0 and
// reproduces the same schedule
// no checkpoint is written for a build's own first day, and none is needed: there is no
// earlier state, so refreshing from index 0 reproduces the same schedule
if(now.Date==start.Date)
{
continue;
}
// from here on, a refresh has to have somewhere to rewind to
@ -83,8 +75,7 @@ public class MultiDayBuildTests : PlayoutBuilderTestBase
@@ -83,8 +75,7 @@ public class MultiDayBuildTests : PlayoutBuilderTestBase
DateTimeOffsetstart=LocalTime(20);
// three weeks of hourly builds, so that progress is far enough along to be clearly
// distinguishable from a playout that restarted at the beginning
// long enough that progress is clearly distinguishable from a playout that restarted
for(varhour=0;hour<24*21;hour++)
{
awaitbuilder.Build(
@ -107,9 +98,8 @@ public class MultiDayBuildTests : PlayoutBuilderTestBase
@@ -107,9 +98,8 @@ public class MultiDayBuildTests : PlayoutBuilderTestBase
result.IsRight.ShouldBeTrue();
// a refresh rewinds to the start of today, so the index legitimately moves back by
// up to a day. a refresh that lost its checkpoints restarts at 0 and only advances
// through the build window, landing an order of magnitude lower
// rewinding to the start of today legitimately moves the index back by up to a day; a refresh
// that lost its checkpoints lands an order of magnitude lower
intafter=HeadIndex(playout);
after.ShouldBeGreaterThan(
before/2,
@ -119,8 +109,7 @@ public class MultiDayBuildTests : PlayoutBuilderTestBase
@@ -119,8 +109,7 @@ public class MultiDayBuildTests : PlayoutBuilderTestBase
@ -145,9 +134,7 @@ public class MultiDayBuildTests : PlayoutBuilderTestBase
@@ -145,9 +134,7 @@ public class MultiDayBuildTests : PlayoutBuilderTestBase
result.IsRight.ShouldBeTrue($"build failed at {now:yyyy-MM-dd HH:mm}");
// every day the playout covers needs a checkpoint, so that a refresh on any of them has
// somewhere to rewind to. the build's own first day is the one exception, and days
// already in the past are pruned
// every day covered needs a checkpoint, except the build's own first day; past days are pruned
@ -263,14 +250,9 @@ public class MultiDayBuildTests : PlayoutBuilderTestBase
@@ -263,14 +250,9 @@ public class MultiDayBuildTests : PlayoutBuilderTestBase
return(builder,playout,referenceData);
}
/// <summary>
/// Anchor dates are compared in machine-local time
/// (<see cref="PlayoutProgramScheduleAnchor.AnchorDateOffset" />), so the test clock has to be local
/// too, or day boundaries won't line up. That means these tests run in whatever zone the machine is
/// in - UTC on CI, something else locally - so the window below is deliberately placed in mid-June,
/// where no zone has a DST transition. Day-boundary behaviour across a DST change is a separate
/// concern and wants its own test.
/// </summary>
// anchor dates are compared in machine-local time, so the test clock has to be local too or day
// boundaries won't line up. that means running in whatever zone the machine is in, hence mid-June,
@ -15,8 +15,7 @@ public class PlaylistEnumerator : IMediaCollectionEnumerator
@@ -15,8 +15,7 @@ public class PlaylistEnumerator : IMediaCollectionEnumerator
@ -37,11 +36,7 @@ public class PlaylistEnumerator : IMediaCollectionEnumerator
@@ -37,11 +36,7 @@ public class PlaylistEnumerator : IMediaCollectionEnumerator
publicintEnumeratorIndex{get;privateset;}
/// <summary>
/// A playlist position isn't described by index and seed alone - it also lives in
/// <see cref="EnumeratorIndex" />, the batch progress, the ids the cycle still owes and the state of
/// every child enumerator - so the only way back to a position is to replay to it.
/// </summary>
// index and seed don't describe a playlist position, so the only way back to one is to replay to it
// nothing has moved since this state was handed out, so there is nothing to rewind
@ -164,8 +159,7 @@ public class PlaylistEnumerator : IMediaCollectionEnumerator
@@ -164,8 +159,7 @@ public class PlaylistEnumerator : IMediaCollectionEnumerator
@ -226,8 +220,7 @@ public class PlaylistEnumerator : IMediaCollectionEnumerator
@@ -226,8 +220,7 @@ public class PlaylistEnumerator : IMediaCollectionEnumerator
// every season 0 episode was already removed above, so this is a playlist item
// that had nothing else in it
// season 0 is already gone, so this item had nothing else in it
if(enumerator.Count==0)
{
enumerator=null;
@ -309,10 +302,7 @@ public class PlaylistEnumerator : IMediaCollectionEnumerator
@@ -309,10 +302,7 @@ public class PlaylistEnumerator : IMediaCollectionEnumerator
}
}
/// <summary>
/// Puts everything back the way <see cref="Create" /> leaves it for the given seed: children at their
/// starting positions, the playlist items back in seed order, and the cycle owing every item again.
/// </summary>
// must leave exactly what Create leaves for this seed, or replaying from here won't match a rebuild
@ -358,11 +348,8 @@ public class PlaylistEnumerator : IMediaCollectionEnumerator
@@ -358,11 +348,8 @@ public class PlaylistEnumerator : IMediaCollectionEnumerator
}
}
/// <summary>
/// Always shuffles the playlist order rather than the current order, so that the result is a function
/// of that order and the seed - which is all the persisted state gives a rebuild to work from. Cycles
/// reshuffle from the same starting point rather than from wherever the last shuffle landed.
/// </summary>
// shuffles playlist order rather than current order, so the result depends only on that order and the
@ -34,10 +34,7 @@ public sealed class SeasonEpisodeMediaCollectionEnumerator : IMediaCollectionEnu
@@ -34,10 +34,7 @@ public sealed class SeasonEpisodeMediaCollectionEnumerator : IMediaCollectionEnu
}
}
/// <summary>
/// Season 0 is never played in season, episode order. Callers that need to know which items this
/// enumerator will actually play - rather than which items they handed it - share the rule here.
/// </summary>
// shared with callers that need to know what this will play, not what they handed it