public void ExportAndValidate() { CheckDisposed(); // Export. m_exporter.Run(); // Validate. string errors = OxesIO.Validator.GetAnyValidationErrors(m_fileName); Assert.IsNull(errors); }
public void SectionHead_UserDefined() { CheckDisposed(); IStStyle sectionHead = m_scr.FindStyle("Section Head"); int hvoNewStyle = m_stylesheet.MakeNewStyle(); m_stylesheet.PutStyle("Major Massive Huge Section Head", "Use for little tiny sections", hvoNewStyle, sectionHead.Hvo, hvoNewStyle, (int)StyleType.kstParagraph, false, false, sectionHead.Rules); // Create section head with this "user-defined" style. IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(m_book.Hvo); m_scrInMemoryCache.AddSectionHeadParaToSection(section.Hvo, "This is a user-defined section head", "Major Massive Huge Section Head"); m_scrInMemoryCache.AddParaToMockedSectionContent(section.Hvo, "Paragraph"); // Export. m_exporter.Run(); // Validate. string errors = OxesIO.Validator.GetAnyValidationErrors(m_fileName); Assert.IsNull(errors); // Read file and compare to expected results. The first node inside sectionHead should // be trGroup. XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(m_fileName); XmlNode nodeOxes = xmlDoc.ChildNodes[1]; Assert.AreEqual("oxes", nodeOxes.Name); XmlNode nodeOxesText = nodeOxes.FirstChild; Assert.AreEqual("oxesText", nodeOxesText.Name); XmlNode nodeCanon = FindChildNode(nodeOxesText, "canon"); Assert.IsNotNull(nodeCanon); XmlNode nodeBook = nodeCanon.FirstChild; Assert.AreEqual("book", nodeBook.Name); Assert.AreEqual("GEN", nodeBook.Attributes[0].Value); XmlNode nodeSection = FindChildNode(nodeBook, "section"); XmlNode nodeSectionHead = nodeSection.FirstChild; Assert.AreEqual("sectionHead", nodeSectionHead.Name); XmlNode nodeTrGroup = nodeSectionHead.FirstChild; Assert.AreEqual("trGroup", nodeTrGroup.Name); Assert.AreEqual("This is a user-defined section head", nodeTrGroup.FirstChild.InnerText); }