public static int HandleSilentDownload(DownloadBookOptions options)
 {
     // This task will be all the program does. We need to do enough setup so that
     // the download code can work, then tear it down.
     Program.SetUpErrorHandling();
     try
     {
         using (var applicationContainer = new ApplicationContainer())
         {
             Program.SetUpLocalization(applicationContainer);
             Browser.SetUpXulRunner();
             Browser.XulRunnerShutdown += Program.OnXulRunnerShutdown;
             LocalizationManager.SetUILanguage(Settings.Default.UserInterfaceLanguage, false);
             var downloader = new BookDownload(new BloomParseClient(), ProjectContext.CreateBloomS3Client(),
                                               new BookDownloadStartingEvent()); /*not hooked to anything*/;
             // Since Bloom is not a normal console app, when run from a command line, the new command prompt
             // appears at once. The extra newlines here are attempting to separate this from our output.
             Console.WriteLine("\nstarting download");
             downloader.HandleDownloadWithoutProgress(options.Url, options.DestinationPath);
             Console.WriteLine(("\ndownload complete\n"));
         }
         return(0);
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
         Console.WriteLine(ex.Message);
         Console.WriteLine(ex.StackTrace);
         return(1);
     }
 }
        public void Setup()
        {
            _thisTestId = Guid.NewGuid().ToString().Replace('-', '_');

            _workFolder     = new TemporaryFolder("unittest-" + _thisTestId);
            _workFolderPath = _workFolder.FolderPath;
            Assert.AreEqual(0, Directory.GetDirectories(_workFolderPath).Count(), "Some stuff was left over from a previous test");
            Assert.AreEqual(0, Directory.GetFiles(_workFolderPath).Count(), "Some stuff was left over from a previous test");
            // Todo: Make sure the S3 unit test bucket is empty.
            // Todo: Make sure the parse.com unit test book table is empty
            _parseClient                = new BloomParseClientTestDouble(_thisTestId);
            _htmlThumbNailer            = new HtmlThumbNailer(NavigationIsolator.GetOrCreateTheOneNavigationIsolator());
            _uploader                   = new BookUpload(_parseClient, new BloomS3Client(BloomS3Client.UnitTestBucketName), new BookThumbNailer(_htmlThumbNailer));
            _downloader                 = new BookDownload(_parseClient, new BloomS3Client(BloomS3Client.UnitTestBucketName), new BookDownloadStartingEvent());
            _downloader.BookDownLoaded += (sender, args) => _downloadedBooks.Add(args.BookDetails);
        }