public void State_Index_Should_Increment() { List <MediaItem> contents = Episodes(10); var state = new CollectionEnumeratorState(); var chronologicalContent = new ChronologicalMediaCollectionEnumerator(contents, state); for (var i = 0; i < 10; i++) { chronologicalContent.State.Index.Should().Be(i % 10); chronologicalContent.MoveNext(); } }
public void Episodes_Should_Sort_By_Aired() { List <MediaItem> contents = Episodes(10); var state = new CollectionEnumeratorState(); var chronologicalContent = new ChronologicalMediaCollectionEnumerator(contents, state); for (var i = 1; i <= 10; i++) { chronologicalContent.Current.IsSome.Should().BeTrue(); chronologicalContent.Current.Map(x => x.Id).IfNone(-1).Should().Be(i); chronologicalContent.MoveNext(); } }
public void State_Should_Impact_Iterator_Start() { List <MediaItem> contents = Episodes(10); var state = new CollectionEnumeratorState { Index = 5 }; var chronologicalContent = new ChronologicalMediaCollectionEnumerator(contents, state); for (var i = 6; i <= 10; i++) { chronologicalContent.Current.IsSome.Should().BeTrue(); chronologicalContent.Current.Map(x => x.Id).IfNone(-1).Should().Be(i); chronologicalContent.State.Index.Should().Be(i - 1); chronologicalContent.MoveNext(); } }