示例#1
0
        public void Serialize_HasAMedia_MediaIsCorrectlyFormated()
        {
            var playlist = new M3uPlaylist();

            playlist.Add(new M3uItem("foo", 42.42m));
            var serializer = new M3uSerializer();

            var output = serializer.Serialize(playlist);

            output.Should().MatchRegex($"#EXTINF:42.42{newlinePattern}foo{newlinePattern}");
        }
示例#2
0
        public void Serialize_HasAMediaWithNormalTitle_TitleIsTrimmedAndAdded()
        {
            var playlist = new M3uPlaylist();

            playlist.Add(new M3uItem("foo", 0)
            {
                Title = "\t Foo \t"
            });
            var serializer = new M3uSerializer();

            var output = serializer.Serialize(playlist);

            output.Should().MatchRegex($"#EXTINF:0, Foo{newlinePattern}");
        }
示例#3
0
        public void Serialize_HasAMediaWithWhitespaceTitle_TitleIsIgnored()
        {
            var playlist = new M3uPlaylist();

            playlist.Add(new M3uItem("foo", 0)
            {
                Title = " \t"
            });
            var serializer = new M3uSerializer();

            var output = serializer.Serialize(playlist);

            output.Should().MatchRegex($"#EXTINF:0{newlinePattern}");
        }
示例#4
0
        public void Serialize_HasAMedia_MediaIsCorrectlyFormated()
        {
            var playlist = new M3uPlaylist();

            playlist.Add(new M3uItem("foo", 42.42m));

            var output = serializer.Serialize(playlist);

            var pattern =
                @"#EXTINF:42.42" + newlinePattern
                + @"foo" + newlinePattern;

            Assert.Matches(pattern, output);
        }
示例#5
0
        public void Serialize_HasAMediaWithNormalTitle_TitleIsTrimmedAndAdded()
        {
            var playlist = new M3uPlaylist();

            playlist.Add(new M3uItem("foo", 0)
            {
                Title = "\t Foo \t"
            });

            var output = serializer.Serialize(playlist);

            var pattern = @"#EXTINF:0, Foo" + newlinePattern;

            Assert.Matches(pattern, output);
        }
示例#6
0
        public void Serialize_HasAMediaWithWhitespaceTitle_TitleIsIgnored()
        {
            var playlist = new M3uPlaylist();

            playlist.Add(new M3uItem("foo", 0)
            {
                Title = " \t"
            });

            var output = serializer.Serialize(playlist);

            var pattern = @"#EXTINF:0" + newlinePattern;

            Assert.Matches(pattern, output);
        }