public void DownloadHttp() { FileDownloader downloader = new FileDownloader(); foreach (String s in fileSizes.Keys) { downloader.Download(InstallPadTest.GetDownloadPath(s), OUTPUT_DIRECTORY); string fi = Path.Combine(OUTPUT_DIRECTORY, s); // Veryify file exists and is the correct size Assert.IsTrue(InstallPadTest.VerifyExistenceAndSize(fi, fileSizes[s])); } }
public void Cancel() { cancelTestDownloader = new FileDownloader(); cancelTestDownloader.ProgressChanged += new DownloadProgressHandler(Cancel_ProgressChanged); cancelTestDownloader.Download(InstallPadTest.GetDownloadPath("test3.txt"), OUTPUT_DIRECTORY); string fi = Path.Combine(OUTPUT_DIRECTORY, "test3.txt"); // Ensure file exists but is not full, since our block size is 1k and we've only downloaded // one block by this point. Assert.IsTrue(File.Exists(fi)); FileInfo info = new FileInfo(fi); // If block size is 1K, which it is by default, then info.Length should be 1024 Assert.IsTrue(info.Length != 0); Assert.IsTrue(info.Length < fileSizes["test3.txt"]); }