示例#1
0
        public void MoveNext_ImplicitChapter1AndVerse1()
        {
            CheckDisposed();

            IScrSection      sectionCur = ScrSection.CreateSectionWithEmptyParas(m_genesis, 0, false);
            TsStringAccessor heading    = ((StTxtPara)sectionCur.HeadingOA.ParagraphsOS[0]).Contents;
            ITsStrBldr       strBldr    = heading.UnderlyingTsString.GetBldr();

            strBldr.Replace(0, strBldr.Length, "My aching head!", null);
            heading.UnderlyingTsString = strBldr.GetString();

            TsStringAccessor content = ((StTxtPara)sectionCur.ContentOA.ParagraphsOS[0]).Contents;

            strBldr = content.UnderlyingTsString.GetBldr();
            strBldr.Replace(0, strBldr.Length, "Verse One. ", null);
            content.UnderlyingTsString = strBldr.GetString();

            sectionCur.AdjustReferences();

            ScrTxtPara  stPara   = new ScrTxtPara(Cache, sectionCur.ContentOA.ParagraphsOS.HvoArray[0]);
            ScrVerseSet verseSet = new ScrVerseSet(stPara);

            // Iterate through the verses in the paragraph
            ScrVerse verse;

            Assert.IsTrue(verseSet.MoveNext());
            verse = (ScrVerse)verseSet.Current;
            Assert.AreEqual("Verse One. ", verse.Text.Text);
            Assert.AreEqual(01001001, verse.StartRef);
            Assert.AreEqual(01001001, verse.EndRef);

            Assert.IsFalse(verseSet.MoveNext());
        }
示例#2
0
        public void MoveNext_NonNumericChapter()
        {
            CheckDisposed();

            IScrSection      sectionCur = ScrSection.CreateSectionWithEmptyParas(m_genesis, 0, false);
            TsStringAccessor heading    = ((StTxtPara)sectionCur.HeadingOA.ParagraphsOS[0]).Contents;
            ITsStrBldr       strBldr    = heading.UnderlyingTsString.GetBldr();

            strBldr.Replace(0, strBldr.Length, "My aching head!", null);
            heading.UnderlyingTsString = strBldr.GetString();

            TsStringAccessor content = ((StTxtPara)sectionCur.ContentOA.ParagraphsOS[0]).Contents;

            strBldr = content.UnderlyingTsString.GetBldr();
            strBldr.Replace(0, strBldr.Length, "A",
                            StyleUtils.CharStyleTextProps(ScrStyleNames.ChapterNumber, Cache.DefaultVernWs));
            strBldr.Replace(strBldr.Length, strBldr.Length, "Verse One. ",
                            StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs));
            strBldr.Replace(strBldr.Length, strBldr.Length, "2",
                            StyleUtils.CharStyleTextProps(ScrStyleNames.VerseNumber, Cache.DefaultVernWs));
            strBldr.Replace(strBldr.Length, strBldr.Length, " Verse Two. ",
                            StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs));
            content.UnderlyingTsString = strBldr.GetString();

            sectionCur.AdjustReferences();

            ScrTxtPara stPara = new ScrTxtPara(Cache, sectionCur.ContentOA.ParagraphsOS.HvoArray[0]);

            ScrVerseSet verseSet = new ScrVerseSet(stPara);

            // Iterate through the verses in the paragraph
            ScrVerse verse;

            Assert.IsTrue(verseSet.MoveNext());
            verse = (ScrVerse)verseSet.Current;
            Assert.AreEqual("AVerse One. ", verse.Text.Text);
            Assert.AreEqual(01001001, verse.StartRef);
            Assert.AreEqual(01001001, verse.EndRef);

            Assert.IsTrue(verseSet.MoveNext());
            verse = (ScrVerse)verseSet.Current;
            Assert.AreEqual("2 Verse Two. ", verse.Text.Text);
            Assert.AreEqual(01001002, verse.StartRef);
            Assert.AreEqual(01001002, verse.EndRef);

            Assert.IsFalse(verseSet.MoveNext());
        }