示例#1
0
 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;
 }
示例#2
0
        public void DownloadTest()
        {
            string testURL = "https://www.youtube.com/watch?v=J---aiyznGQ";

            DownloadUI testlogic = new DownloadUI();

            testlogic.Download(testURL);
        }
示例#3
0
        public void CheckIfEmptyFalseTest()
        {
            string str = "test";

            DownloadUI testlogic = new DownloadUI();

            Assert.IsFalse(testlogic.CheckIfEmpty(str));
        }
示例#4
0
        public void CheckIfEmptyTrueTest()
        {
            string str = "";

            DownloadUI testlogic = new DownloadUI();

            Assert.IsTrue(testlogic.CheckIfEmpty(str));
        }
示例#5
0
        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));
        }
示例#6
0
        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);
        }