|
|
|
@ -285,6 +285,78 @@ public class PlaylistEnumeratorTests |
|
|
|
items.ShouldBe([20, 30, 10, 11]); |
|
|
|
items.ShouldBe([20, 30, 10, 11]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
|
|
|
|
public async Task CountForFiller_Should_Honor_Custom_Count_And_PlayAll() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// this isn't needed for chronological, so no need to implement anything
|
|
|
|
|
|
|
|
IMediaCollectionRepository repo = Substitute.For<IMediaCollectionRepository>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var playlistItemMap = new Dictionary<PlaylistItem, List<MediaItem>> |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new PlaylistItem |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Id = 1, |
|
|
|
|
|
|
|
Index = 0, |
|
|
|
|
|
|
|
PlaybackOrder = PlaybackOrder.Chronological, |
|
|
|
|
|
|
|
PlayAll = false, |
|
|
|
|
|
|
|
Count = 2, |
|
|
|
|
|
|
|
CollectionType = CollectionType.Collection, |
|
|
|
|
|
|
|
CollectionId = 1 |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
[FakeMovie(10), FakeMovie(11), FakeMovie(12)] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new PlaylistItem |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Id = 2, |
|
|
|
|
|
|
|
Index = 1, |
|
|
|
|
|
|
|
PlaybackOrder = PlaybackOrder.Chronological, |
|
|
|
|
|
|
|
PlayAll = false, |
|
|
|
|
|
|
|
CollectionType = CollectionType.Collection, |
|
|
|
|
|
|
|
CollectionId = 2 |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
[FakeMovie(15)] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new PlaylistItem |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Id = 3, |
|
|
|
|
|
|
|
Index = 2, |
|
|
|
|
|
|
|
PlaybackOrder = PlaybackOrder.Chronological, |
|
|
|
|
|
|
|
PlayAll = false, |
|
|
|
|
|
|
|
CollectionType = CollectionType.Collection, |
|
|
|
|
|
|
|
CollectionId = 3 |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
[FakeMovie(20)] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new PlaylistItem |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Id = 4, |
|
|
|
|
|
|
|
Index = 3, |
|
|
|
|
|
|
|
PlaybackOrder = PlaybackOrder.Chronological, |
|
|
|
|
|
|
|
PlayAll = true, |
|
|
|
|
|
|
|
CollectionType = CollectionType.Collection, |
|
|
|
|
|
|
|
CollectionId = 4 |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
[FakeMovie(25), FakeMovie(26), FakeMovie(27)] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var state = new CollectionEnumeratorState { Seed = 1 }; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlaylistEnumerator enumerator = await PlaylistEnumerator.Create( |
|
|
|
|
|
|
|
repo, |
|
|
|
|
|
|
|
playlistItemMap, |
|
|
|
|
|
|
|
state, |
|
|
|
|
|
|
|
shufflePlaylistItems: true, |
|
|
|
|
|
|
|
batchSize: Option<int>.None, |
|
|
|
|
|
|
|
CancellationToken.None); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enumerator.CountForFiller.ShouldBe(7); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static Movie FakeMovie(int id) => new() |
|
|
|
private static Movie FakeMovie(int id) => new() |
|
|
|
{ |
|
|
|
{ |
|
|
|
Id = id, |
|
|
|
Id = id, |
|
|
|
|