protected void TestDeserializedExtraData(IPlaylistHandler handler, string playlistFile)
        {
            string outputFile = Path.Combine(OutputPath, "SavedExtraData.bplist");

            Directory.CreateDirectory(OutputPath);
            if (File.Exists(outputFile))
            {
                File.Delete(outputFile);
            }
            Assert.IsTrue(File.Exists(playlistFile), $"Could not find test file at '{playlistFile}'");

            using var fs = File.OpenRead(playlistFile);
            IPlaylist playlist = handler.Deserialize(fs);
            Dictionary <string, object> customData = playlist.CustomData ?? new Dictionary <string, object>();

            if (customData["extensionStringList"] is JArray)
            {
                Assert.Fail("Failed to convert string list.");
            }
            if (customData["extensionIntList"] is JArray)
            {
                Assert.Fail("Failed to convert int list.");
            }
            Assert.AreEqual(123, Convert.ToInt32(customData["customInt"]));
            Assert.AreEqual("test string", customData["extensionString"]);
            Assert.AreEqual(123.456d, customData["extensionFloat"]);
            using var fs2 = File.Create(outputFile);
            handler.Serialize(playlist, fs2);
        }
 /// <summary>
 /// Attempts to deserialize and return an <see cref="IPlaylist"/> from a file.
 /// </summary>
 /// <param name="handler"><see cref="IPlaylistHandler"/> to use.</param>
 /// <param name="path">Path to the file.</param>
 /// <returns>An <see cref="IPlaylist"/>.</returns>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="path"/> is null or empty.</exception>
 /// <exception cref="ArgumentException">Thrown if a file at <paramref name="path"/> does not exist.</exception>
 /// <exception cref="PlaylistSerializationException">Thrown if an error occurs while deserializing.</exception>
 public static IPlaylist Deserialize(this IPlaylistHandler handler, string path)
 {
     if (handler == null)
     {
         throw new ArgumentNullException(nameof(handler), $"{nameof(handler)} cannot be null.");
     }
     if (string.IsNullOrEmpty(path))
     {
         throw new ArgumentNullException(nameof(path), "path cannot be null or empty.");
     }
     path = Path.GetFullPath(path);
     if (!File.Exists(path))
     {
         throw new ArgumentException($"File at '{path}' does not exist or is inaccessible.");
     }
     try
     {
         using FileStream stream = Utilities.OpenFileRead(path);
         return(handler.Deserialize(stream));
     }
     catch (Exception ex)
     {
         throw new PlaylistSerializationException(ex.Message, ex);
     }
 }