public async Task TestValid_FTPDownloader_DownloadFilesAsync() { FTPDownloader ftpDownloader = new FTPDownloader(); await ftpDownloader.DownloadFilesAsync(new string[] { "ftp://speedtest.tele2.net/1KB.zip" }); using (SHA256Managed sha = new SHA256Managed()) { var hash = sha.ComputeHash(new FileStream("./Download/1KB.zip", FileMode.Open, FileAccess.Read)); Assert.Equal("X3C/GKCGAHAW6UiwSu07ghA6Nr6kF1W2zd+vEKzjxu8=", Convert.ToBase64String(hash)); } }
public async Task TestEmpty_FTPDownloader_DownloadFilesAsync() { FTPDownloader ftpDownloader = new FTPDownloader(); var ufe = await Assert.ThrowsAsync <UriFormatException>(() => ftpDownloader.DownloadFilesAsync(new string[] { "" })); Assert.Equal("Invalid URI: The URI is empty.", ufe.Message); }
public async Task TestInvalid_FTPDownloader_DownloadFilesAsync() { FTPDownloader ftpDownloader = new FTPDownloader(); var ufe = await Assert.ThrowsAsync <UriFormatException>(() => ftpDownloader.DownloadFilesAsync(new string[] { "Invalid" })); Assert.Equal("Invalid URI: The format of the URI could not be determined.", ufe.Message); }
public async Task TestNull_FTPDownloader_DownloadFilesAsync() { FTPDownloader ftpDownloader = new FTPDownloader(); var ane = await Assert.ThrowsAsync <ArgumentNullException>(() => ftpDownloader.DownloadFilesAsync(null)); Assert.Equal("Value cannot be null. (Parameter 'source')", ane.Message); }