コード例 #1
0
        public void DownloadingFromNonExistingDomainThrows()
        {
            using (var test = StartTest(withHttpServer: true))
            {
                var fileSystem = SPath.FileSystem;

                var downloadTask    = new DownloadTask(test.TaskManager, "http://ggggithub.com/robots.txt", test.TestPath);
                var exceptionThrown = false;

                var autoResetEvent = new AutoResetEvent(false);

                downloadTask.FinallyInline(success => {
                    exceptionThrown = !success;
                    autoResetEvent.Set();
                })
                .Start();

                Assert.True(autoResetEvent.WaitOne(Timeout));
                Assert.True(exceptionThrown);
            }
        }