本文整理汇总了C#中Bloom.Book.HtmlDom.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlDom.Clone方法的具体用法?C# HtmlDom.Clone怎么用?C# HtmlDom.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bloom.Book.HtmlDom
的用法示例。
在下文中一共展示了HtmlDom.Clone方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Setup
public virtual void Setup()
{
_storage = new Moq.Mock<IBookStorage>();
_storage.Setup(x => x.GetLooksOk()).Returns(true);
_bookDom = new HtmlDom(GetThreePageDom());
_storage.SetupGet(x => x.Dom).Returns(() => _bookDom);
_storage.SetupGet(x => x.Key).Returns("testkey");
_storage.SetupGet(x => x.FileName).Returns("testTitle");
_storage.Setup(x => x.GetRelocatableCopyOfDom(It.IsAny<IProgress>())).Returns(() =>
{
return
_bookDom.Clone();
});// review: the real thing does more than just clone
_storage.Setup(x => x.MakeDomRelocatable(It.IsAny<HtmlDom>(), It.IsAny<IProgress>())).Returns(
(HtmlDom x, IProgress y) => { return x.Clone(); });// review: the real thing does more than just clone
_storage.Setup(x => x.GetFileLocator()).Returns(() => _fileLocator.Object);
_testFolder = new TemporaryFolder("BookTests");
_tempFolder = new TemporaryFolder(_testFolder, "book");
MakeSamplePngImageWithMetadata(Path.Combine(_tempFolder.Path, "original.png"));
_storage.SetupGet(x => x.FolderPath).Returns(_tempFolder.Path);// review: the real thing does more than just clone
_metadata = new BookInfo(_tempFolder.Path, true);
_storage.SetupGet(x => x.MetaData).Returns(_metadata);
_storage.Setup(x => x.HandleRetiredXMatterPacks(It.IsAny<HtmlDom>(), It.IsAny<string>()))
.Returns((HtmlDom dom, string y) => { return y == "BigBook" ? "Factory" : y; });
_templateFinder = new Moq.Mock<ITemplateFinder>();
_fileLocator = new Moq.Mock<IFileLocator>();
string root = FileLocator.GetDirectoryDistributedWithApplication(BloomFileLocator.BrowserRoot);
string xMatter = BloomFileLocator.GetInstalledXMatterDirectory();
_fileLocator.Setup(x => x.LocateFileWithThrow("languageDisplay.css")).Returns("../notareallocation/languageDisplay.css");
_fileLocator.Setup(x => x.LocateFileWithThrow("previewMode.css")).Returns("../notareallocation/previewMode.css");
_fileLocator.Setup(x => x.LocateFileWithThrow("origami.css")).Returns("../notareallocation/origami.css");
_fileLocator.Setup(x => x.LocateFileWithThrow("editMode.css")).Returns("../notareallocation/editMode.css");
_fileLocator.Setup(x => x.LocateFileWithThrow("editTranslationMode.css")).Returns("../notareallocation/editTranslationMode.css");
_fileLocator.Setup(x => x.LocateFileWithThrow("editOriginalMode.css")).Returns("../notareallocation/editOriginalMode.css");
_fileLocator.Setup(x => x.LocateFileWithThrow("editPaneGlobal.css")).Returns("../notareallocation/editPaneGlobal.css");
_fileLocator.Setup(x => x.LocateFileWithThrow("basePage.css")).Returns("../notareallocation/basePage.css");
_fileLocator.Setup(x => x.LocateFileWithThrow("bloomBootstrap.js")).Returns("../notareallocation/bloomBootstrap.js");
_fileLocator.Setup(x => x.LocateFileWithThrow("bloomPreviewBootstrap.js")).Returns("../notareallocation/bloomPreviewBootstrap.js");
_fileLocator.Setup(x => x.LocateFileWithThrow("baseEPUB.css")).Returns("../notareallocation/baseEPUB.css");
_fileLocator.Setup(x => x.LocateFileWithThrow("customBookStyles.css")).Returns(Path.Combine(_tempFolder.Path, "customBookStyles.css"));
_fileLocator.Setup(x => x.LocateFileWithThrow("settingsCollectionStyles.css")).Returns(Path.Combine(_testFolder.Path, "settingsCollectionStyles.css"));
_fileLocator.Setup(x => x.LocateFileWithThrow("customCollectionStyles.css")).Returns(Path.Combine(_testFolder.Path, "customCollectionStyles.css"));
_fileLocator.Setup(x => x.LocateDirectory("Factory-XMatter")).Returns(xMatter.CombineForPath("Factory-XMatter"));
_fileLocator.Setup(x => x.LocateDirectoryWithThrow("Factory-XMatter")).Returns(xMatter.CombineForPath("Factory-XMatter"));
_fileLocator.Setup(x => x.LocateDirectory("Factory-XMatter", It.IsAny<string>())).Returns(xMatter.CombineForPath("Factory-XMatter"));
_fileLocator.Setup(x => x.LocateFileWithThrow("Factory-XMatter".CombineForPath("Factory-XMatter.htm"))).Returns(xMatter.CombineForPath("Factory-XMatter", "Factory-XMatter.htm"));
_fileLocator.Setup(x => x.LocateDirectory("Traditional-XMatter")).Returns(xMatter.CombineForPath("Traditional-XMatter"));
_fileLocator.Setup(x => x.LocateDirectoryWithThrow("Traditional-XMatter")).Returns(xMatter.CombineForPath("Traditional-XMatter"));
_fileLocator.Setup(x => x.LocateDirectory("Traditional-XMatter", It.IsAny<string>())).Returns(xMatter.CombineForPath("Traditional-XMatter"));
_fileLocator.Setup(x => x.LocateFileWithThrow("Traditional-XMatter".CombineForPath("Traditional-XMatter.htm"))).Returns(xMatter.CombineForPath("Traditional-XMatter", "Factory-XMatter.htm"));
_fileLocator.Setup(x => x.LocateDirectory("BigBook-XMatter")).Returns(xMatter.CombineForPath("BigBook-XMatter"));
_fileLocator.Setup(x => x.LocateDirectoryWithThrow("BigBook-XMatter")).Returns(xMatter.CombineForPath("BigBook-XMatter"));
_fileLocator.Setup(x => x.LocateDirectory("BigBook-XMatter", It.IsAny<string>())).Returns(xMatter.CombineForPath("BigBook-XMatter"));
_fileLocator.Setup(x => x.LocateFileWithThrow("BigBook-XMatter".CombineForPath("BigBook-XMatter.htm"))).Returns(xMatter.CombineForPath("BigBook-XMatter", "BigBook-XMatter.htm"));
//warning: we're neutering part of what the code under test is trying to do here:
_fileLocator.Setup(x => x.CloneAndCustomize(It.IsAny<IEnumerable<string>>())).Returns(_fileLocator.Object);
_thumbnailer = new Moq.Mock<HtmlThumbNailer>(new object[] { new NavigationIsolator() });
_pageSelection = new Mock<PageSelection>();
_pageListChangedEvent = new PageListChangedEvent();
}
示例2: Setup
public void Setup()
{
_storage = new Moq.Mock<IBookStorage>();
_storage.Setup(x => x.GetLooksOk()).Returns(true);
_bookDom = new HtmlDom(GetThreePageDom());
_storage.SetupGet(x => x.Dom).Returns(() => _bookDom);
_storage.SetupGet(x => x.Key).Returns("testkey");
_storage.SetupGet(x => x.FileName).Returns("testTitle");
_storage.SetupGet(x => x.BookType).Returns(Bloom.Book.Book.BookType.Publication);
_storage.Setup(x => x.GetRelocatableCopyOfDom(It.IsAny<IProgress>())).Returns(()=>
{
return
_bookDom.Clone();
});// review: the real thing does more than just clone
_storage.Setup(x => x.MakeDomRelocatable(It.IsAny<HtmlDom>(),It.IsAny<IProgress>())).Returns(
(HtmlDom x, IProgress y) => {return x.Clone();});// review: the real thing does more than just clone
_storage.Setup(x => x.GetFileLocator()).Returns(()=>_fileLocator.Object);
_testFolder = new TemporaryFolder("BookTests");
_tempFolder = new TemporaryFolder(_testFolder, "book");
MakeSamplePngImageWithMetadata(Path.Combine(_tempFolder.Path,"original.png"));
_storage.SetupGet(x => x.FolderPath).Returns(_tempFolder.Path);// review: the real thing does more than just clone
_templateFinder = new Moq.Mock<ITemplateFinder>();
_fileLocator = new Moq.Mock<IFileLocator>();
string root = FileLocator.GetDirectoryDistributedWithApplication("BloomBrowserUI");
string xMatter = FileLocator.GetDirectoryDistributedWithApplication("xMatter");
string factoryCollections = FileLocator.GetDirectoryDistributedWithApplication("factoryCollections");
string templates = FileLocator.GetDirectoryDistributedWithApplication("factoryCollections","templates");
_fileLocator.Setup(x => x.LocateFileWithThrow("languageDisplayTemplate.css")).Returns(root.CombineForPath("bookLayout","languageDisplayTemplate.css"));
_fileLocator.Setup(x => x.LocateFileWithThrow("previewMode.css")).Returns("../notareallocation/previewMode.css");
_fileLocator.Setup(x => x.LocateFileWithThrow("editMode.css")).Returns("../notareallocation/editMode.css");
_fileLocator.Setup(x => x.LocateFileWithThrow("editTranslationMode.css")).Returns("../notareallocation/editTranslationMode.css");
_fileLocator.Setup(x => x.LocateFileWithThrow("editOriginalMode.css")).Returns("../notareallocation/editOriginalMode.css");
_fileLocator.Setup(x => x.LocateFileWithThrow("basePage.css")).Returns("../notareallocation/basePage.css");
_fileLocator.Setup(x => x.LocateFileWithThrow("bloomBootstrap.js")).Returns("../notareallocation/bloomBootstrap.js");
_fileLocator.Setup(x => x.LocateFileWithThrow("bloomPreviewBootstrap.js")).Returns("../notareallocation/bloomPreviewBootstrap.js");
_fileLocator.Setup(x => x.LocateDirectory("Factory-XMatter")).Returns(xMatter.CombineForPath("Factory-XMatter"));
_fileLocator.Setup(x => x.LocateDirectory("Factory-XMatter", It.IsAny<string>())).Returns(xMatter.CombineForPath("Factory-XMatter"));
_fileLocator.Setup(x => x.LocateFileWithThrow("Factory-XMatter".CombineForPath("Factory-XMatter.htm"))).Returns(xMatter.CombineForPath("Factory-XMatter", "Factory-XMatter.htm"));
//warning: we're neutering part of what the code under test is trying to do here:
_fileLocator.Setup(x => x.CloneAndCustomize(It.IsAny<IEnumerable<string>>())).Returns(_fileLocator.Object);
_thumbnailer = new Moq.Mock<HtmlThumbNailer>(new object[] { 60 });
_pageSelection = new Mock<PageSelection>();
_pageListChangedEvent = new PageListChangedEvent();
}
示例3: MakeDomRelocatable
/// <summary>
/// this one works on the dom passed to it
/// </summary>
/// <param name="dom"></param>
/// <param name="log"></param>
/// <returns></returns>
public HtmlDom MakeDomRelocatable(HtmlDom dom, IProgress log)
{
var relocatableDom = dom.Clone();
SetBaseForRelativePaths(relocatableDom, _folderPath, true);
EnsureHasLinksToStylesheets(relocatableDom);
UpdateStyleSheetLinkPaths(relocatableDom, _fileLocator, log);
return relocatableDom;
}
示例4: MakeDomRelocatable
/// <summary>
/// this one works on the dom passed to it
/// </summary>
/// <param name="dom"></param>
/// <param name="log"></param>
/// <returns></returns>
public HtmlDom MakeDomRelocatable(HtmlDom dom, IProgress log = null)
{
var relocatableDom = dom.Clone();
SetBaseForRelativePaths(relocatableDom, _folderPath);
EnsureHasLinksToStylesheets(relocatableDom);
return relocatableDom;
}