Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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));
            }
        }