Exemple #1
0
        public void ExportNotationParagraphs_Hyperlink()
        {
            IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(m_book.Hvo);
            StTxtPara   para    = m_scrInMemoryCache.AddParaToMockedSectionContent(section.Hvo,
                                                                                   ScrStyleNames.NormalParagraph);
            IScrScriptureNote note = m_scrInMemoryCache.AddAnnotation(para, new BCVRef(01001001),
                                                                      NoteType.Translator, "This is some text with a hyperlink!");
            TsStringAccessor tssaDisc = ((StTxtPara)note.DiscussionOA.ParagraphsOS[0]).Contents;

            tssaDisc.MarkTextAsHyperlink(tssaDisc.Length - 10, tssaDisc.Length - 1,
                                         "http://www.myspace.com", m_stylesheet);

            StringWriter  stream = new StringWriter();
            XmlTextWriter writer = new XmlTextWriter(stream);

            m_exporter = new ExportXml(null, Cache, null, ExportWhat.AllBooks, 0, 0, 0,
                                       "ExportNotationParagraphs_Hyperlink");

            ReflectionHelper.SetField(m_exporter, "m_writer", writer);
            ReflectionHelper.CallMethod(m_exporter, "ExportNotationParagraphs", note.DiscussionOA,
                                        "notationDiscussion");
            Assert.AreEqual("<notationDiscussion><para xml:lang=\"en\">" +
                            "<span>This is some text with a </span>" +
                            "<a href=\"http://www.myspace.com\">hyperlink</a>" +
                            "<span>!</span>" +
                            "</para></notationDiscussion>", stream.ToString());
        }