예제 #1
0
        public void Seek_CalledWhenPaused_DoesntDemuxNextPacket()
        {
            AsyncContext.Run(async() =>
            {
                var demuxerMock = Substitute.For <IDemuxer>();
                demuxerMock.IsInitialized().Returns(true);

                using (var controller = new DemuxerController(demuxerMock))
                {
                    controller.Pause();
                    await controller.Seek(TimeSpan.FromSeconds(5), CancellationToken.None);
                    await demuxerMock.DidNotReceive().NextPacket();
                }
            });
        }
예제 #2
0
        public void Seek_Called_ListensForEos()
        {
            AsyncContext.Run(async() =>
            {
                var demuxerStub = Substitute.For <IDemuxer>();
                demuxerStub.NextPacket().Returns(Utils.TaskExtensions.Never <Packet>());
                demuxerStub.Completion.Returns(Task.CompletedTask);

                using (var controller = new DemuxerController(demuxerStub))
                {
                    var packetReady = controller.PacketReady().FirstAsync().ToTask();

                    await controller.Seek(TimeSpan.FromSeconds(5), CancellationToken.None);

                    var packet = await packetReady;
                    Assert.That(packet, Is.Null);
                }
            });
        }