示例#1
0
        public void ShouldAddDvbSubsFilter()
        {
            // Arranges
            SetMockServices();
            FakeVideoSettings settings = new FakeVideoSettings(new VideoSettings
            {
                EnableDvbSubtitles = true, EnableTeletextSubtitles = true, EnableAtscClosedCaptions = true
            });

            ServiceRegistration.Set <ISettingsManager>(settings);

            ISubtitleRenderer mockSubtitleRenderer = Mock.Of <ISubtitleRenderer>();
            TsReaderStub      tsReaderStub         = new TsReaderStub
            {
                TeletextStreamCount = 0,
                SubtitleStreamCount = 1
            };
            MockedTsVideoPlayer tsVideoPlayer = new MockedTsVideoPlayer(mockSubtitleRenderer, tsReaderStub);

            // Act
            tsVideoPlayer.AddSubtitleFilter();

            // Assert
            Mock.Get(mockSubtitleRenderer).Verify(x => x.AddDvbSubtitleFilter(It.IsAny <IGraphBuilder>()), Times.Once);
            Mock.Get(mockSubtitleRenderer).Verify(x => x.AddClosedCaptionsFilter(It.IsAny <IGraphBuilder>()), Times.Never);
            Mock.Get(mockSubtitleRenderer).Verify(x => x.AddTeletextSubtitleDecoder(It.IsAny <ITeletextSource>()), Times.Never);
        }
 public MockedTsVideoPlayer(ISubtitleRenderer subtitleRenderer, TsReaderStub tsReaderStub)
 {
     _tsReader         = tsReaderStub;
     _subtitleRenderer = subtitleRenderer;
 }