예제 #1
0
        public void MoveToTimeLine_WebVttHasNoTimeLine_ReturnsNull()
        {
            WebVttBuilder builder = new WebVttBuilder();

            builder.AddWebVttHeader()
            .AddNote()
            .AddStyle();

            using (var stream = CreateStream(builder.ToString()))
            {
                var parser = CreateWebVttParser();
                var line   = parser.MoveToTimeLine(new StreamReader(stream));

                Assert.That(line, Is.Null);
            }
        }
예제 #2
0
        public void MoveToTimeLine_WebVttHasAllParts_ReturnsFirstTimeLine()
        {
            WebVttBuilder builder = new WebVttBuilder();

            builder.AddWebVttHeader()
            .AddStyle()
            .AddNote()
            .AddCueTitle()
            .AddCueTimeLine()
            .AddCueText();

            using (var stream = CreateStream(builder.ToString()))
            {
                var parser = CreateWebVttParser();
                var line   = parser.MoveToTimeLine(new StreamReader(stream));

                Assert.That(line, Is.EqualTo(WebVttBuilder.CueTimeLine));
            }
        }
예제 #3
0
        public void MoveToTimeLine_WebVttHasTwoTimeLines_ReturnsBoth()
        {
            WebVttBuilder builder = new WebVttBuilder();

            builder.AddWebVttHeader()
            .AddCueTitle()
            .AddCueTimeLine()
            .AddCueText()
            .AddCueTitle()
            .AddCueTimeLine()
            .AddCueText();

            using (var stream = CreateStream(builder.ToString()))
            {
                var parser = CreateWebVttParser();
                var reader = new StreamReader(stream);

                var firstTimeLine  = parser.MoveToTimeLine(reader);
                var secondTimeLine = parser.MoveToTimeLine(reader);

                Assert.That(firstTimeLine, Is.EqualTo(WebVttBuilder.CueTimeLine));
                Assert.That(secondTimeLine, Is.EqualTo(WebVttBuilder.CueTimeLine));
            }
        }