コード例 #1
0
ファイル: Tests.cs プロジェクト: joelchen/MultiDownloader
        public async Task TestZeroLength_HTTPDownloader_DownloadFilesAsync()
        {
            HTTPDownloader httpDownloader = new HTTPDownloader();
            var            e = await Record.ExceptionAsync(() => httpDownloader.DownloadFilesAsync(new string[0]));

            Assert.Null(e);
        }
コード例 #2
0
ファイル: Tests.cs プロジェクト: joelchen/MultiDownloader
        public async Task TestValid_HTTPDownloader_DownloadFilesAsync()
        {
            HTTPDownloader httpDownloader = new HTTPDownloader();
            await httpDownloader.DownloadFilesAsync(new string[] { "https://www.google.com.sg/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" });

            using (SHA256Managed sha = new SHA256Managed())
            {
                var hash = sha.ComputeHash(new FileStream("./Download/googlelogo_color_272x92dp.png", FileMode.Open, FileAccess.Read));
                Assert.Equal("V3bNh2F+rOw7wA689TDRkkAmAz7ahS9wbBpnWpiRWCY=", Convert.ToBase64String(hash));
            }
        }
コード例 #3
0
ファイル: Tests.cs プロジェクト: joelchen/MultiDownloader
        public async Task TestInvalid_HTTPDownloader_DownloadFilesAsync()
        {
            HTTPDownloader httpDownloader = new HTTPDownloader();
            var            ufe            = await Assert.ThrowsAsync <UriFormatException>(() => httpDownloader.DownloadFilesAsync(new string[] { "Invalid" }));

            Assert.Equal("Invalid URI: The format of the URI could not be determined.", ufe.Message);
        }
コード例 #4
0
ファイル: Tests.cs プロジェクト: joelchen/MultiDownloader
        public async Task TestEmpty_HTTPDownloader_DownloadFilesAsync()
        {
            HTTPDownloader httpDownloader = new HTTPDownloader();
            var            ufe            = await Assert.ThrowsAsync <UriFormatException>(() => httpDownloader.DownloadFilesAsync(new string[] { "" }));

            Assert.Equal("Invalid URI: The URI is empty.", ufe.Message);
        }
コード例 #5
0
ファイル: Tests.cs プロジェクト: joelchen/MultiDownloader
        public async Task TestNull_HTTPDownloader_DownloadFilesAsync()
        {
            HTTPDownloader httpDownloader = new HTTPDownloader();
            var            ane            = await Assert.ThrowsAsync <ArgumentNullException>(() => httpDownloader.DownloadFilesAsync(null));

            Assert.Equal("Value cannot be null. (Parameter 'source')", ane.Message);
        }