public async Task TestZeroLength_HTTPDownloader_DownloadFilesAsync() { HTTPDownloader httpDownloader = new HTTPDownloader(); var e = await Record.ExceptionAsync(() => httpDownloader.DownloadFilesAsync(new string[0])); Assert.Null(e); }
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)); } }
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); }
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); }
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); }