/// <summary>
        /// Make an ePUB out of the specified book. Sets up several instance variables with commonly useful parts of the results.
        /// </summary>
        /// <returns></returns>
        protected virtual ZipFile MakeEpub(string mainFileName, string folderName, Bloom.Book.Book book,
                                           BookInfo.HowToPublishImageDescriptions howToPublishImageDescriptions = BookInfo.HowToPublishImageDescriptions.None,
                                           string branding = "Default", Action <EpubMaker> extraInit = null)
        {
            book.CollectionSettings.BrandingProjectKey = branding;

            // BringBookUpToDate is done on entering the Publish tab, outside the scope of these tests.
            // But note that it must be done AFTER setting the branding (which in Bloom will happen well before
            // entering the Publish tab).
            book.BringBookUpToDate(new NullProgress());
            var epubFolder = new TemporaryFolder(folderName);
            var epubName   = mainFileName + ".epub";
            var epubPath   = Path.Combine(epubFolder.FolderPath, epubName);

            using (var maker = CreateEpubMaker(book))
            {
                maker.Unpaginated = true;                 // Currently we always make unpaginated epubs.
                maker.PublishImageDescriptions = howToPublishImageDescriptions;
                extraInit?.Invoke(maker);
                maker.SaveEpub(epubPath, new NullWebSocketProgress());
            }
            Assert.That(File.Exists(epubPath));
            _epub               = new ZipFile(epubPath);
            _manifestFile       = ExportEpubTestsBaseClass.GetManifestFile(_epub);
            _manifestContent    = StripXmlHeader(GetZipContent(_epub, _manifestFile));
            _manifestDoc        = XDocument.Parse(_manifestContent);
            _defaultSourceValue = $"created from Bloom book on {DateTime.Now:yyyy-MM-dd} with page size A5 Portrait";
            return(_epub);
        }
        /// <summary>
        /// Check that all the files referenced in the manifest are actually present in the zip.
        /// </summary>
        void VerifyThatFilesInManifestArePresent()
        {
            XNamespace opf   = "http://www.idpf.org/2007/opf";
            var        files = _manifestDoc.Root.Element(opf + "manifest").Elements(opf + "item").Select(item => item.Attribute("href").Value);

            foreach (var file in files)
            {
                ExportEpubTestsBaseClass.GetZipEntry(_epub, Path.GetDirectoryName(_manifestFile) + "/" + file);
            }
        }
 protected string GetFileData(string fileName)
 {
     return(ExportEpubTestsBaseClass.GetZipContent(_epub, Path.GetDirectoryName(_manifestFile) + "/" + fileName));
 }