public void Serialize_ItemTitleSerializedCorrect_True() { var sb = new StringBuilder() .AppendLine("[playlist]") .AppendLine() .AppendLine("File1=test path") .AppendLine("Title1=test title") .AppendLine() .AppendLine("NumberOfEntries=1") .AppendLine("Version=2"); var serializer = new PlsSerializer(); var pls = new PlsPlaylist { Version = "2" }; pls.Add(new PlsItem("test path") { Title = "test title" }); var result = serializer.Serialize(pls); sb.ToString().Should().Be(result); }
public void Serialize_LengthNotNumberBecomesZero_True() { var sb = new StringBuilder() .AppendLine("[playlist]") .AppendLine() .AppendLine("File1=test path") .AppendLine("Length1=0") .AppendLine() .AppendLine("NumberOfEntries=1") .AppendLine("Version=2"); var serializer = new PlsSerializer(); var pls = new PlsPlaylist { Version = "2" }; pls.Add(new PlsItem("test path") { Length = "sgsgsgsg" }); var result = serializer.Serialize(pls); sb.ToString().Should().Be(result); }
public void Serialize_CorrectNumberOfEntries_True() { var pls = new PlsPlaylist { Version = "2" }; pls.Add(new PlsItem("test path") { Title = "test title", Length = "sgsgsgsg" }); pls.Add(new PlsItem("test path") { Title = "test title2", Length = "10" }); var serializer = new PlsSerializer(); var result = serializer.Serialize(pls); result.Should().Contain("NumberOfEntries=2"); }