public void FileToListTest() { IList <string> youtubeList = YouTubeService.FileToList(FromFile).ToList(); youtubeList.Count().ShouldBe(3); youtubeList.ShouldContain("https://www.youtube.com/watch?v=pYlYt9iuJdc"); youtubeList.ShouldAllBe(e => e.StartsWith("https://www.youtube.com/watch?v=")); }
public static void Main(string[] args) { var input = args.Length == 0 ? "" : args[0]; if (input == "-d" || input == "--dummy") { CreateSampleList(); Service.YoutubeToMp3(ShortVideos); } else if (input.EndsWith(".txt")) { var enumerable = Service.FileToList(input); var urls = enumerable as IList <string> ?? enumerable.ToList(); if (!urls.Any()) { System.Console.WriteLine("Your list is empty"); } else { Service.YoutubeToMp3(urls); } } else if (input == "-l" || input == "--list") { if (string.IsNullOrWhiteSpace(args[1])) { } else { try { Service.YoutubeToMp3(GetList(args[1])); } catch { Help("download"); } } } else if (input == "-h" || input == "--help" || input.Any()) { Help(); } }