public static MakeDom ( string bodyContents, string headContents = "" ) : |
||
bodyContents | string | |
headContents | string | |
return |
public void CheckBook_NoMetaLicenseId_ReturnsNull() { var dom = BookTestsBase.MakeDom(@"<div class='bloom-page numberedPage customPage A5Portrait'> <div id='testDiv' class='marginBox'> <div class='bloom-translationGroup bloom-trailingElement normal-style'> <div class='bloom-editable normal-style cke_focus bloom-content1 bloom-visibility-code-on' contenteditable='true' lang='xyz'> some text </div> </div> </div> </div>" ); var checker = new LicenseChecker(); LicenseChecker.SetAllowInternetAccess(false); LicenseChecker.SetOfflineFolder(null); Assert.That(checker.CheckBook(dom, new[] { "en", "fr" }), Is.Null); LicenseChecker.SetAllowInternetAccess(true); Assert.That(checker.CheckBook(dom, new[] { "en", "fr" }), Is.Null); }
private static HtmlDom MakeDomWithLicenseMeta() { // The really critical thing about this DOM is that the head (second argument) contains the bloom-licensed-content-id metadata. // The LicenseChecker doesn't pay any attention to the book content. However, we don't usually expect to ask about languages // that don't occur, so in the interests of making a slightly more realistic test, I put in some book content. return(BookTestsBase.MakeDom(@"<div class='bloom-page numberedPage customPage A5Portrait'> <div id='testDiv' class='marginBox'> <div class='bloom-translationGroup bloom-trailingElement normal-style'> <div class='bloom-editable normal-style cke_focus bloom-content1 bloom-visibility-code-on' contenteditable='true' lang='en'> some text </div> <div class='bloom-editable normal-style cke_focus bloom-content1 bloom-visibility-code-on' contenteditable='true' lang='fr'> french text </div> <div class='bloom-editable normal-style cke_focus bloom-content1 bloom-visibility-code-on' contenteditable='true' lang='ru'> french text </div> </div> </div> </div>" , "<meta name='bloom-licensed-content-id' content='kingstone.superbible.ruth'></meta>")); }