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}"); }
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}"); }
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}"); }
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); }
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); }
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); }