private void updates() { Load.Visibility = Visibility.Visible; LoadingT.Content = "Loading.."; Lists.Children.Clear(); if (DownloadData.getInstance().fileStatus != null) { foreach (var d in DownloadData.getInstance().fileStatus) { var ui = new DownloadUI(); ui.setFileName(d.Key); ui.setFilePath(d.Value.fileLocation); ui.setStatus(d.Value.percentage); ui.setFileSizeAndDate(d.Value.maxFileSize + "MB | " + d.Value.Date); ui.setIdentity(d.Key.Substring(d.Key.LastIndexOf('.'))); ui.Loaded += (c, s) => { ui.Height = 74; ui.Width = 340; }; Lists.Children.Add(ui); } } if (Lists.Children.Count < 1) { LoadingT.Content = "Can't find any files"; return; } Load.Visibility = Visibility.Hidden; }
public void DownloadTest() { string testURL = "https://www.youtube.com/watch?v=J---aiyznGQ"; DownloadUI testlogic = new DownloadUI(); testlogic.Download(testURL); }
public void CheckIfEmptyFalseTest() { string str = "test"; DownloadUI testlogic = new DownloadUI(); Assert.IsFalse(testlogic.CheckIfEmpty(str)); }
public void CheckIfEmptyTrueTest() { string str = ""; DownloadUI testlogic = new DownloadUI(); Assert.IsTrue(testlogic.CheckIfEmpty(str)); }
public void CheckDependenciesThrowsExceptionTest() { string testpath = AppDomain.CurrentDomain.BaseDirectory.ToString(); List <string> testDependencies = new List <string>() { "\\ffmpeg.exe", "\\youtube-dl.exe", "\\randomfile.txt" }; DownloadUI testlogic = new DownloadUI(); Assert.ThrowsException <System.IO.FileNotFoundException>(() => testlogic.CheckDependencies(testpath, testDependencies)); }
public void CheckDependenciesSucceedTest() { string testpath = AppDomain.CurrentDomain.BaseDirectory.ToString(); List <string> testDependencies = new List <string>() { "\\ffmpeg.exe", "\\youtube-dl.exe" }; DownloadUI testlogic = new DownloadUI(); testlogic.CheckDependencies(testpath, testDependencies); }