예제 #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);
        }