コード例 #1
0
        public void DownloadFile_WhenErrorOccursDuringDownload_ReleasesWebClient()
        {
            webClientMock.When(client => client.DownloadFile(Arg.Any <Uri>(), Arg.Any <string>()))
            .Do(callInfo => { throw new Exception(); });

            Assert.Throws <Exception>(() => systemUnderTest.DownloadFile(filePayload));

            Received.InOrder(() =>
            {
                webClientMock.DownloadFile(filePayload.DownloadUri, filePayload.DownloadFilePath);
                webClientFactoryMock.Release(webClientMock);
            });
        }
コード例 #2
0
 public void Download(string SrourcePath, string DestinationDirectory, DownloadInfo info = null)
 {
     try
     {
         client.DownloadFile(SrourcePath, DestinationDirectory + "\\" + Helper.GetFileName(SrourcePath));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
コード例 #3
0
        public void DownloadPages(string path, string url)
        {
            if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException();
            }

            var fileDownloaded = _webClient.DownloadFile(path, url);

            if (fileDownloaded)
            {
                _dBRepository.SaveDetailsToDB(url, path);
            }
        }
コード例 #4
0
 private void DownloadImage(Uri posterURL, string posterDestination)
 {
     WebClient.DownloadFile(posterURL, posterDestination);
 }
コード例 #5
0
 private void DownloadFile(FilePayload filePayload, IWebClient webClient)
 {
     webClient.DownloadFile(filePayload.DownloadUri, filePayload.DownloadFilePath);
 }
コード例 #6
0
        private string[] GetStockData(string ticker, string queryParameters)
        {
            var stockData = webClient.DownloadFile(ticker, queryParameters);

            return(stockData.Split(','));
        }
コード例 #7
0
 public static void DownloadFile(this IWebClient client, Uri address)
 {
     client.DownloadFile(address, PathUtilities.SanitizePath(PathUtilities.GetFilename(address.AbsoluteUri), SanitizePathOptions.StripInvalidFilenameChars));
 }