public void DownloadingFromNonExistingDomainThrows() { Stopwatch watch; ILogging logger; StartTest(out watch, out logger); var fileSystem = NPath.FileSystem; var downloadTask = new DownloadTask(TaskManager.Token, fileSystem, "http://ggggithub.com/robots.txt", TestBasePath); var exceptionThrown = false; var autoResetEvent = new AutoResetEvent(false); StartTrackTime(watch); downloadTask .Finally(success => { exceptionThrown = !success; autoResetEvent.Set(); }) .Start(); autoResetEvent.WaitOne(Timeout).Should().BeTrue("Finally raised the signal");; StopTrackTimeAndLog(watch, logger); exceptionThrown.Should().BeTrue(); }
public void DownloadingNonExistingFileThrows() { Stopwatch watch; ILogging logger; StartTest(out watch, out logger); var fileSystem = NPath.FileSystem; var taskFailed = false; Exception exceptionThrown = null; var autoResetEvent = new AutoResetEvent(false); var downloadTask = new DownloadTask(TaskManager.Token, fileSystem, $"http://localhost:{server.Port}/nope", TestBasePath); StartTrackTime(watch); downloadTask .Finally((success, exception) => { taskFailed = !success; exceptionThrown = exception; autoResetEvent.Set(); }) .Start(); var ret = autoResetEvent.WaitOne(Timeout); StopTrackTimeAndLog(watch, logger); ret.Should().BeTrue("Finally raised the signal"); taskFailed.Should().BeTrue(); exceptionThrown.Should().NotBeNull(); }