Exemple #1
0
        public void Equals_FollowsGuidelines()
        {
            var sectionCur = Cache.ServiceLocator.GetInstance <IScrSectionFactory>().CreateScrSection(
                m_genesis, 0, "Verse One. ", StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs), false);

            var stPara = (IScrTxtPara)sectionCur.ContentOA.ParagraphsOS[0];

            using (var verseSet1 = new ScrVerseSet(stPara))
            {
                using (var verseSet2 = new ScrVerseSet(stPara))
                {
                    using (var verseSet3 = new ScrVerseSet(stPara))
                    {
                        // Iterate through the verses in the paragraph
                        Assert.IsTrue(verseSet1.MoveNext());
                        Assert.IsTrue(verseSet2.MoveNext());
                        Assert.IsTrue(verseSet3.MoveNext());

                        var x = verseSet1.Current;
                        var y = verseSet2.Current;
                        var z = verseSet3.Current;
                        Assert.IsTrue(x.Equals(x));
                        Assert.AreEqual(x.Equals(y), y.Equals(x));
                        Assert.AreEqual(x.Equals(z), x.Equals(y) && y.Equals(z));
                        Assert.AreEqual(x.Equals(y), x.Equals(y));
                        Assert.IsFalse(x.Equals(null));
                    }
                }
            }
        }
Exemple #2
0
        public void MoveNext_StanzaBreak()
        {
            IScrSection section   = AddSectionToMockedBook(m_genesis);
            IScrTxtPara emptyPara = AddEmptyPara(section, ScrStyleNames.StanzaBreak);

            // Create and iterate through the verses in the StText.
            using (ScrVerseSet verseSet = new ScrVerseSet(emptyPara))
            {
                Assert.IsTrue(verseSet.MoveNext());
                ScrVerse verse = verseSet.Current;
                Assert.IsTrue(verse.Text == null || string.IsNullOrEmpty(verse.Text.Text));
                Assert.AreEqual(ScrStyleNames.StanzaBreak, verse.Para.StyleName);
                Assert.AreEqual(01001001, verse.StartRef);
                Assert.AreEqual(01001001, verse.EndRef);
                Assert.IsFalse(verseSet.MoveNext());
            }
        }
Exemple #3
0
        public void MoveNext_ImplicitChapter1AndVerse1()
        {
            var sectionCur = Cache.ServiceLocator.GetInstance <IScrSectionFactory>().CreateScrSection(
                m_genesis, 0, "Verse One. ", StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs), false);

            var stPara = (IScrTxtPara)sectionCur.ContentOA.ParagraphsOS[0];

            using (var verseSet = new ScrVerseSet(stPara))
            {
                // Iterate through the verses in the paragraph
                Assert.IsTrue(verseSet.MoveNext());
                var verse = verseSet.Current;
                Assert.AreEqual("Verse One. ", verse.Text.Text);
                Assert.AreEqual(01001001, verse.StartRef);
                Assert.AreEqual(01001001, verse.EndRef);

                Assert.IsFalse(verseSet.MoveNext());
            }
        }
Exemple #4
0
        public void MoveNext_EmptyPara()
        {
            IScrSection section   = AddSectionToMockedBook(m_genesis);
            IScrTxtPara emptyPara = AddEmptyPara(section, ScrStyleNames.SpeechLine1);

            // Create and iterate through the verses in the StText.
            using (ScrVerseSet verseSet = new ScrVerseSet(emptyPara))
            {
                Assert.IsFalse(verseSet.MoveNext(),
                               "The iterator provided a ScrVerse for an empty para that wasn't a Stanza Break.");
            }
        }
Exemple #5
0
        public void MoveNext_NonNumericChapter()
        {
            IScrSection sectionCur = Cache.ServiceLocator.GetInstance <IScrSectionFactory>().CreateSection(
                m_genesis, 0, false, true, true);

            IScrTxtPara contentPara = (IScrTxtPara)sectionCur.ContentOA.ParagraphsOS[0];
            ITsStrBldr  strBldr     = contentPara.Contents.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));
            contentPara.Contents = strBldr.GetString();

            using (ScrVerseSet verseSet = new ScrVerseSet(contentPara))
            {
                // Iterate through the verses in the paragraph
                ScrVerse verse;

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

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

                Assert.IsFalse(verseSet.MoveNext());
            }
        }
Exemple #6
0
		public void MoveNext_EmptyPara()
		{
			CheckDisposed();
			IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(m_genesis.Hvo);
			StTxtPara emptyPara = AddEmptyPara(section, ScrStyleNames.SpeechLine1);
			section.AdjustReferences();

			// Create and iterate through the verses in the StText.
			ScrTxtPara emptyScrPara = new ScrTxtPara(m_inMemoryCache.Cache, emptyPara.Hvo);
			ScrVerseSet verseSet = new ScrVerseSet(emptyScrPara);

			Assert.IsFalse(verseSet.MoveNext(),
				"The iterator provided a ScrVerse for an empty para that wasn't a Stanza Break.");
		}
Exemple #7
0
		public void MoveNext_StanzaBreak()
		{
			CheckDisposed();
			IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(m_genesis.Hvo);
			StTxtPara emptyPara = AddEmptyPara(section, ScrStyleNames.StanzaBreak);
			section.AdjustReferences();

			// Create and iterate through the verses in the StText.
			ScrTxtPara emptyScrPara = new ScrTxtPara(m_inMemoryCache.Cache, emptyPara.Hvo);
			ScrVerseSet verseSet = new ScrVerseSet(emptyScrPara);

			Assert.IsTrue(verseSet.MoveNext());
			VerifyScrVerse((ScrVerse)verseSet.Current, m_inMemoryCache.Cache, null,
				ScrStyleNames.StanzaBreak, 01001001, 01001001);
			Assert.IsFalse(verseSet.MoveNext());
		}
Exemple #8
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());
		}
Exemple #9
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());
		}
Exemple #10
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Navigate to the beginning of the text of the first (implicit or explicit) chapter
		/// in the first paragraph in the specified scripture section. If a chapter isn't
		/// found then the IP is put at the beginning of the content paragraph.
		/// </summary>
		/// <param name="iBook">0-based index of the book (in this view)</param>
		/// <param name="section">The section (in the given book, as displayed in this view)
		/// </param>
		/// ------------------------------------------------------------------------------------
		private void GoToFirstChapterInSection(int iBook, IScrSection section)
		{
			int ichChapterStart = 0;
			using (ScrVerseSet verseSet = new ScrVerseSet((IScrTxtPara)section.ContentOA[0]))
			{
			if (verseSet.MoveNext())
			{
				ScrVerse verse = verseSet.Current;
				if (!verse.VerseNumberRun)
					ichChapterStart = verse.TextStartIndex;
			}
			}

			ScrReference scrRef = new ScrReference(section.VerseRefStart, m_scr.Versification);
			GoToPosition(scrRef, iBook, section, 0, ichChapterStart);
		}
Exemple #11
0
        public void MoveNext_SpacesInVerses_ChapterNumberSeparate()
        {
            IScrSection sectionCur = AddSectionToMockedBook(m_genesis);

            // Create a section head for this section
            AddSectionHeadParaToSection(sectionCur, "My aching head!", ScrStyleNames.SectionHead);

            StTxtParaBldr paraBldr = new StTxtParaBldr(Cache);

            paraBldr.ParaStyleName = ScrStyleNames.NormalParagraph;
            paraBldr.AppendRun("1", StyleUtils.CharStyleTextProps(ScrStyleNames.ChapterNumber,
                                                                  Cache.DefaultVernWs));
            paraBldr.AppendRun("Verse One. ",
                               StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs));
            paraBldr.AppendRun("2", StyleUtils.CharStyleTextProps(ScrStyleNames.VerseNumber,
                                                                  Cache.DefaultVernWs));
            paraBldr.AppendRun(" Verse Two. ",
                               StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs));
            paraBldr.AppendRun("3", StyleUtils.CharStyleTextProps(ScrStyleNames.VerseNumber,
                                                                  Cache.DefaultVernWs));
            paraBldr.AppendRun("Verse Three.",
                               StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs));
            paraBldr.AppendRun("4", StyleUtils.CharStyleTextProps(ScrStyleNames.VerseNumber,
                                                                  Cache.DefaultVernWs));
            paraBldr.AppendRun("     ",
                               StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs));
            IScrTxtPara para = (IScrTxtPara)paraBldr.CreateParagraph(sectionCur.ContentOA);

            using (ScrVerseSet verseSet = new ScrVerseSet(para))
            {
                // Iterate through the verses in the paragraph
                ScrVerse verse;

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

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

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

                Assert.IsTrue(verseSet.MoveNext());
                verse = verseSet.Current;
                Assert.AreEqual("3Verse Three.", verse.Text.Text);
                Assert.AreEqual(01001003, verse.StartRef);
                Assert.AreEqual(01001003, verse.EndRef);

                Assert.IsTrue(verseSet.MoveNext());
                verse = verseSet.Current;
                Assert.AreEqual("4     ", verse.Text.Text);
                Assert.AreEqual(01001004, verse.StartRef);
                Assert.AreEqual(01001004, verse.EndRef);

                Assert.IsFalse(verseSet.MoveNext());
            }
        }
Exemple #12
0
		public void MoveNext_StanzaBreak()
		{
			IScrSection section = AddSectionToMockedBook(m_genesis);
			IScrTxtPara emptyPara = AddEmptyPara(section, ScrStyleNames.StanzaBreak);

			// Create and iterate through the verses in the StText.
			using (ScrVerseSet verseSet = new ScrVerseSet(emptyPara))
			{
				Assert.IsTrue(verseSet.MoveNext());
			ScrVerse verse = verseSet.Current;
				Assert.IsTrue(verse.Text == null || string.IsNullOrEmpty(verse.Text.Text));
				Assert.AreEqual(ScrStyleNames.StanzaBreak, verse.Para.StyleName);
				Assert.AreEqual(01001001, verse.StartRef);
				Assert.AreEqual(01001001, verse.EndRef);
				Assert.IsFalse(verseSet.MoveNext());
			}
		}
Exemple #13
0
		public void MoveNext_NonNumericChapter()
		{
			IScrSection sectionCur = Cache.ServiceLocator.GetInstance<IScrSectionFactory>().CreateSection(
				m_genesis, 0, false, true, true);

			IScrTxtPara contentPara = (IScrTxtPara)sectionCur.ContentOA.ParagraphsOS[0];
			ITsStrBldr strBldr = contentPara.Contents.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));
			contentPara.Contents = strBldr.GetString();

			using (ScrVerseSet verseSet = new ScrVerseSet(contentPara))
			{
				// Iterate through the verses in the paragraph
				ScrVerse verse;

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

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

				Assert.IsFalse(verseSet.MoveNext());
			}
		}
Exemple #14
0
		public void MoveNext_SpacesInVerses()
		{
			CheckDisposed();

			ScrSection sectionCur = new ScrSection();
			m_genesis.SectionsOS.Append(sectionCur);
			// Create a section head for this section
			sectionCur.HeadingOA = new StText();
			StTxtParaBldr paraBldr = new StTxtParaBldr(Cache);
			paraBldr.ParaProps = StyleUtils.ParaStyleTextProps(ScrStyleNames.SectionHead);
			paraBldr.AppendRun("My aching head!",
				StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs));
			paraBldr.CreateParagraph(sectionCur.HeadingOAHvo);
			sectionCur.ContentOA = new StText();

			paraBldr = new StTxtParaBldr(Cache);
			paraBldr.ParaProps = StyleUtils.ParaStyleTextProps(ScrStyleNames.NormalParagraph);
			paraBldr.AppendRun("1", StyleUtils.CharStyleTextProps(ScrStyleNames.ChapterNumber,
				Cache.DefaultVernWs));
			paraBldr.AppendRun("Verse One. ",
				StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs));
			paraBldr.AppendRun("2", StyleUtils.CharStyleTextProps(ScrStyleNames.VerseNumber,
				Cache.DefaultVernWs));
			paraBldr.AppendRun(" Verse Two. ",
				StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs));
			paraBldr.AppendRun("3", StyleUtils.CharStyleTextProps(ScrStyleNames.VerseNumber,
				Cache.DefaultVernWs));
			paraBldr.AppendRun("Verse Three.",
				StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs));
			paraBldr.AppendRun("4", StyleUtils.CharStyleTextProps(ScrStyleNames.VerseNumber,
				Cache.DefaultVernWs));
			paraBldr.AppendRun("     ",
				StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs));
			StTxtPara para = paraBldr.CreateParagraph(sectionCur.ContentOA.Hvo);
			sectionCur.AdjustReferences();

			ScrTxtPara stPara = new ScrTxtPara(Cache, para.Hvo);
			ScrVerseSet verseSet = new ScrVerseSet(stPara);

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

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

			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.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.IsTrue(verseSet.MoveNext());
			verse = (ScrVerse)verseSet.Current;
			Assert.AreEqual("3Verse Three.", verse.Text.Text);
			Assert.AreEqual(01001003, verse.StartRef);
			Assert.AreEqual(01001003, verse.EndRef);

			Assert.IsTrue(verseSet.MoveNext());
			verse = (ScrVerse)verseSet.Current;
			Assert.AreEqual("4     ", verse.Text.Text);
			Assert.AreEqual(01001004, verse.StartRef);
			Assert.AreEqual(01001004, verse.EndRef);

			Assert.IsFalse(verseSet.MoveNext());
		}
Exemple #15
0
		public void MoveNext_EmptyPara()
		{
			IScrSection section = AddSectionToMockedBook(m_genesis);
			IScrTxtPara emptyPara = AddEmptyPara(section, ScrStyleNames.SpeechLine1);

			// Create and iterate through the verses in the StText.
			using (ScrVerseSet verseSet = new ScrVerseSet(emptyPara))
			{
				Assert.IsFalse(verseSet.MoveNext(),
					"The iterator provided a ScrVerse for an empty para that wasn't a Stanza Break.");
			}
		}
Exemple #16
0
		public void MoveNext_SpacesInVerses_ChapterNumberSeparate()
		{
			IScrSection sectionCur = AddSectionToMockedBook(m_genesis);
			// Create a section head for this section
			AddSectionHeadParaToSection(sectionCur, "My aching head!", ScrStyleNames.SectionHead);

			StTxtParaBldr paraBldr = new StTxtParaBldr(Cache);
				paraBldr.ParaStyleName = ScrStyleNames.NormalParagraph;
				paraBldr.AppendRun("1", StyleUtils.CharStyleTextProps(ScrStyleNames.ChapterNumber,
					Cache.DefaultVernWs));
				paraBldr.AppendRun("Verse One. ",
					StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs));
				paraBldr.AppendRun("2", StyleUtils.CharStyleTextProps(ScrStyleNames.VerseNumber,
					Cache.DefaultVernWs));
				paraBldr.AppendRun(" Verse Two. ",
					StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs));
				paraBldr.AppendRun("3", StyleUtils.CharStyleTextProps(ScrStyleNames.VerseNumber,
					Cache.DefaultVernWs));
				paraBldr.AppendRun("Verse Three.",
					StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs));
				paraBldr.AppendRun("4", StyleUtils.CharStyleTextProps(ScrStyleNames.VerseNumber,
					Cache.DefaultVernWs));
				paraBldr.AppendRun("     ",
					StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs));
				IScrTxtPara para = (IScrTxtPara)paraBldr.CreateParagraph(sectionCur.ContentOA);

				using (ScrVerseSet verseSet = new ScrVerseSet(para))
				{
					// Iterate through the verses in the paragraph
					ScrVerse verse;

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

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

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

					Assert.IsTrue(verseSet.MoveNext());
				verse = verseSet.Current;
					Assert.AreEqual("3Verse Three.", verse.Text.Text);
					Assert.AreEqual(01001003, verse.StartRef);
					Assert.AreEqual(01001003, verse.EndRef);

					Assert.IsTrue(verseSet.MoveNext());
				verse = verseSet.Current;
					Assert.AreEqual("4     ", verse.Text.Text);
					Assert.AreEqual(01001004, verse.StartRef);
					Assert.AreEqual(01001004, verse.EndRef);

					Assert.IsFalse(verseSet.MoveNext());
				}
			}
Exemple #17
0
		public void Equals_FollowsGuidelines()
		{
			var sectionCur = Cache.ServiceLocator.GetInstance<IScrSectionFactory>().CreateScrSection(
				m_genesis, 0, "Verse One. ", StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs), false);

			var stPara = (IScrTxtPara)sectionCur.ContentOA.ParagraphsOS[0];
			using (var verseSet1 = new ScrVerseSet(stPara))
			{
				using (var verseSet2 = new ScrVerseSet(stPara))
				{
					using (var verseSet3 = new ScrVerseSet(stPara))
					{
						// Iterate through the verses in the paragraph
						Assert.IsTrue(verseSet1.MoveNext());
						Assert.IsTrue(verseSet2.MoveNext());
						Assert.IsTrue(verseSet3.MoveNext());

						var x = verseSet1.Current;
						var y = verseSet2.Current;
						var z = verseSet3.Current;
						Assert.IsTrue(x.Equals(x));
						Assert.AreEqual(x.Equals(y), y.Equals(x));
						Assert.AreEqual(x.Equals(z), x.Equals(y) && y.Equals(z));
						Assert.AreEqual(x.Equals(y), x.Equals(y));
						Assert.IsFalse(x.Equals(null));
					}
				}
			}
		}
Exemple #18
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Navigate to the beginning of the text of the first (implicit or explicit) chapter
		/// in the first paragraph in the specified scripture section. If a chapter isn't
		/// found then the IP is put at the beginning of the content paragraph.
		/// </summary>
		/// <param name="iBook">0-based index of the book (in this view)</param>
		/// <param name="section">The section (in the given book, as displayed in this view)
		/// </param>
		/// ------------------------------------------------------------------------------------
		private void GoToFirstChapterInSection(int iBook, ScrSection section)
		{
			int ichChapterStart = 0;
			ScrVerseSet verseSet = new ScrVerseSet(new ScrTxtPara(m_cache, section[0].Hvo));
			if (verseSet.MoveNext())
			{
				ScrVerse verse = (ScrVerse)verseSet.Current;
				if (!verse.VerseNumberRun)
					ichChapterStart = verse.TextStartIndex;
			}

			ScrReference scrRef = new ScrReference(section.VerseRefStart, m_scr.Versification);
			GoToPosition(scrRef, iBook, section, 0, ichChapterStart);
		}
Exemple #19
0
		public void MoveNext_ImplicitChapter1AndVerse1()
		{
			var sectionCur = Cache.ServiceLocator.GetInstance<IScrSectionFactory>().CreateScrSection(
				m_genesis, 0, "Verse One. ", StyleUtils.CharStyleTextProps(null, Cache.DefaultVernWs), false);

			var stPara = (IScrTxtPara)sectionCur.ContentOA.ParagraphsOS[0];

			using (var verseSet = new ScrVerseSet(stPara))
			{
				// Iterate through the verses in the paragraph
				Assert.IsTrue(verseSet.MoveNext());
				var verse = verseSet.Current;
				Assert.AreEqual("Verse One. ", verse.Text.Text);
				Assert.AreEqual(01001001, verse.StartRef);
				Assert.AreEqual(01001001, verse.EndRef);

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