mirror of https://github.com/ErsatzTV/ErsatzTV.git
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.
78 lines
3.0 KiB
78 lines
3.0 KiB
using System; |
|
using System.Collections.Generic; |
|
using ErsatzTV.Core.Domain; |
|
using ErsatzTV.Core.Domain.Filler; |
|
using ErsatzTV.Core.Interfaces.Scheduling; |
|
using ErsatzTV.Core.Scheduling; |
|
using LanguageExt; |
|
|
|
namespace ErsatzTV.Core.Tests.Scheduling |
|
{ |
|
public abstract class SchedulerTestBase |
|
{ |
|
protected static PlayoutBuilderState StartState => new( |
|
0, |
|
Prelude.None, |
|
Prelude.None, |
|
false, |
|
false, |
|
1, |
|
new DateTimeOffset(new DateTime(2020, 10, 18, 0, 0, 0, DateTimeKind.Local))); |
|
|
|
protected virtual ProgramScheduleItem NextScheduleItem => new ProgramScheduleItemOne |
|
{ |
|
StartTime = null |
|
}; |
|
|
|
protected static DateTimeOffset HardStop => StartState.CurrentTime.AddHours(6); |
|
|
|
protected static Dictionary<CollectionKey, IMediaCollectionEnumerator> CollectionEnumerators( |
|
ProgramScheduleItem scheduleItem, IMediaCollectionEnumerator enumerator) => |
|
new() |
|
{ |
|
{ CollectionKey.ForScheduleItem(scheduleItem), enumerator } |
|
}; |
|
|
|
protected static Dictionary<CollectionKey, IMediaCollectionEnumerator> CollectionEnumerators( |
|
ProgramScheduleItem scheduleItem, IMediaCollectionEnumerator enumerator1, |
|
FillerPreset fillerPreset, IMediaCollectionEnumerator enumerator2, |
|
FillerPreset fillerPreset2, IMediaCollectionEnumerator enumerator3) => |
|
new() |
|
{ |
|
{ CollectionKey.ForScheduleItem(scheduleItem), enumerator1 }, |
|
{ CollectionKey.ForFillerPreset(fillerPreset), enumerator2 }, |
|
{ CollectionKey.ForFillerPreset(fillerPreset2), enumerator3 } |
|
}; |
|
|
|
private static Movie TestMovie(int id, TimeSpan duration, DateTime aired) => |
|
new() |
|
{ |
|
Id = id, |
|
MovieMetadata = new List<MovieMetadata> { new() { ReleaseDate = aired } }, |
|
MediaVersions = new List<MediaVersion> |
|
{ |
|
new() { Duration = duration } |
|
} |
|
}; |
|
|
|
protected static Collection TwoItemCollection(int id1, int id2, TimeSpan duration) => new() |
|
{ |
|
Id = id1, |
|
Name = $"Collection of Items {id1}", |
|
MediaItems = new List<MediaItem> |
|
{ |
|
TestMovie(id1, duration, new DateTime(2020, 1, 1)), |
|
TestMovie(id2, duration, new DateTime(2020, 1, 2)) |
|
} |
|
}; |
|
|
|
protected static Dictionary<CollectionKey, IMediaCollectionEnumerator> CollectionEnumerators( |
|
ProgramScheduleItem scheduleItem, IMediaCollectionEnumerator enumerator1, |
|
FillerPreset fillerPreset, IMediaCollectionEnumerator enumerator2) => |
|
new() |
|
{ |
|
{ CollectionKey.ForScheduleItem(scheduleItem), enumerator1 }, |
|
{ CollectionKey.ForFillerPreset(fillerPreset), enumerator2 } |
|
}; |
|
} |
|
}
|
|
|