Пример #1
0
 void AssertOriginalCopyrightAndLicense(HtmlDom dom, string copyright, string license, string licenseNotes = "")
 {
     Assert.That(dom.GetBookSetting("originalCopyright")["*"], Is.EqualTo(copyright));
     if (string.IsNullOrEmpty(copyright))
     {
         AssertThatXmlIn.Dom(dom.RawDom).HasNoMatchForXpath("//div[@id='bloomDataDiv']/div[@data-book='originalCopyright']");
     }
     Assert.That(dom.GetBookSetting("originalLicenseUrl")["*"], Is.EqualTo(license));
     if (string.IsNullOrEmpty(license))
     {
         AssertThatXmlIn.Dom(dom.RawDom).HasNoMatchForXpath("//div[@id='bloomDataDiv']/div[@data-book='originalLicenseUrl']");
     }
     Assert.That(dom.GetBookSetting("originalLicenseNotes")["*"], Is.EqualTo(licenseNotes));
     if (string.IsNullOrEmpty(licenseNotes))
     {
         AssertThatXmlIn.Dom(dom.RawDom).HasNoMatchForXpath("//div[@id='bloomDataDiv']/div[@data-book='originalLicenseNotes']");
     }
 }
Пример #2
0
        public void GetBookSetting_NotThere_ReturnsEmptyMultistring()
        {
            var bookDom = new HtmlDom(@"<html ><head></head><body>
				<div id='bloomDataDiv'>
				</div>
			 </body></html>"            );
            var result  = bookDom.GetBookSetting("getMe");

            Assert.AreEqual(0, result.Count);
        }
Пример #3
0
        public void GetBookSetting_TwoVariationsWereThere_ReturnsBoth()
        {
            var bookDom = new HtmlDom(@"<html ><head></head><body>
				<div id='bloomDataDiv'>
						<div data-book='leaveMe' lang='en'>something unique</div>
						<div data-book='getMe' lang='id'>Buku</div>
						<div data-book='getMe' lang='tpi'>Buk</div>
				</div>
			 </body></html>"            );
            var result  = bookDom.GetBookSetting("getMe");

            Assert.AreEqual(2, result.Count);
            Assert.AreEqual("Buk", result["tpi"]);
            Assert.AreEqual("Buku", result["id"]);
        }
        private static string GetEnglishOriginalCopyrightAndLicense(HtmlDom dom)
        {
            var multiTextBase = dom.GetBookSetting("originalCopyrightAndLicense");

            return(multiTextBase["*"]);
        }