public void IsConvertingToMp3() { MediaDownloader downloader = new MediaDownloader(); MediaFile mediaFile = MediaFile.CreateNew(VboxDownloadConvertTests.VboxDownloadVideo); string existingPath = Path.Combine(Directory.GetCurrentDirectory(), mediaFile.Metadata.FileName + mediaFile.Metadata.FileExtension); if (!File.Exists(existingPath)) { downloader.Download(mediaFile, Directory.GetCurrentDirectory()); } MediaConverter converter = new MediaConverter(); ConvertResult result = converter.Convert(mediaFile, existingPath, Directory.GetCurrentDirectory(), new MediaConverterMetadata(Bitrates.Kbps192)); Assert.IsTrue(result.IsConverted); Assert.IsTrue(File.Exists(result.ConvertedPath)); }
public void ConversionEndedEventTest() { MediaDownloader downloader = new MediaDownloader(); MediaFile file = MediaFile.CreateNew(VboxDownloadVideo); string downloadedPath = downloader.Download(file, Environment.GetFolderPath(Environment.SpecialFolder.Desktop)).DownloadPath; bool converting = false; MediaConverter converter = new MediaConverter(); converter.MediaFileConvertionCompelete += delegate { converting = true; }; converter.Convert(file, downloadedPath, Environment.GetFolderPath(Environment.SpecialFolder.Desktop), new MediaConverterMetadata { AudioBitrate = Bitrates.Kbps192, Extension = SupportedConversionFormats.Mp3, FileName = file.Metadata.FileName }); Assert.AreEqual(true, converting); }