public void Find_FromMiddle()
        {
            FindCollectorEnv collectorEnv = new FindCollectorEnv(m_vc,
                                                                 Cache.DomainDataByFlid, m_para1.Owner.Hvo, (int)StTextFrags.kfrText,
                                                                 m_pattern, null);

            // Start in the middle
            SelLevInfo[] levInfo = new SelLevInfo[1];
            levInfo[0].hvo = m_para2.Hvo;
            levInfo[0].tag = StTextTags.kflidParagraphs;
            m_sel          = new FindCollectorEnv.LocationInfo(levInfo, StTxtParaTags.kflidContents, 5);

            VerifyFindNext(collectorEnv, m_para2.Hvo, 20, 21);
            VerifyFindNext(collectorEnv, m_para2.Hvo, 27, 28);
            VerifyFindNext(collectorEnv, m_para2.Hvo, 44, 45);
            VerifyFindNext(collectorEnv, m_para2.Hvo, 52, 53);
            VerifyFindNext(collectorEnv, m_para2.Hvo, 64, 65);
            Assert.IsNull(collectorEnv.FindNext(m_sel));

            // Make sure nothing got replaced by accident.
            Assert.AreEqual("This is some text so that we can test the find functionality.",
                            m_para1.Contents.Text);
            Assert.AreEqual("Some more text so that we can test the find and replace functionality.",
                            m_para2.Contents.Text);
            Assert.AreEqual("This purugruph doesn't contuin the first letter of the ulphubet.",
                            m_para3.Contents.Text);
        }
        public void Find_FromTop()
        {
            CheckDisposed();

            FindCollectorEnv collectorEnv = new FindCollectorEnv(m_vc,
                                                                 Cache.MainCacheAccessor, m_para1.OwnerHVO, (int)StTextFrags.kfrText,
                                                                 m_pattern, null);

            // Start at the top
            SelLevInfo[] levInfo = new SelLevInfo[1];
            levInfo[0].hvo = m_para1.Hvo;
            levInfo[0].tag = (int)StText.StTextTags.kflidParagraphs;
            m_sel          = new FindCollectorEnv.LocationInfo(levInfo,
                                                               (int)StTxtPara.StTxtParaTags.kflidContents, 0);

            VerifyFindNext(collectorEnv, m_para1.Hvo, 23, 24);
            VerifyFindNext(collectorEnv, m_para1.Hvo, 30, 31);
            VerifyFindNext(collectorEnv, m_para1.Hvo, 55, 56);
            VerifyFindNext(collectorEnv, m_para2.Hvo, 20, 21);
            VerifyFindNext(collectorEnv, m_para2.Hvo, 27, 28);
            VerifyFindNext(collectorEnv, m_para2.Hvo, 44, 45);
            VerifyFindNext(collectorEnv, m_para2.Hvo, 52, 53);
            VerifyFindNext(collectorEnv, m_para2.Hvo, 64, 65);
            Assert.IsNull(collectorEnv.FindNext(m_sel));

            // Make sure nothing got replaced by accident.
            Assert.AreEqual("This is some text so that we can test the find functionality.",
                            m_para1.Contents.Text);
            Assert.AreEqual("Some more text so that we can test the find and replace functionality.",
                            m_para2.Contents.Text);
            Assert.AreEqual("This purugruph doesn't contuin the first letter of the ulphubet.",
                            m_para3.Contents.Text);
        }
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Verifies the find next.
 /// </summary>
 /// <param name="collectorEnv">The collector env.</param>
 /// <param name="hvoExpected">The hvo expected.</param>
 /// <param name="ichMinExpected">The ich min expected.</param>
 /// <param name="ichLimExpected">The ich lim expected.</param>
 /// ------------------------------------------------------------------------------------
 private void VerifyFindNext(FindCollectorEnv collectorEnv, int hvoExpected,
                             int ichMinExpected, int ichLimExpected)
 {
     FindCollectorEnv.LocationInfo foundLocation = collectorEnv.FindNext(m_sel);
     Assert.IsNotNull(foundLocation);
     Assert.AreEqual(1, foundLocation.m_location.Length);
     Assert.AreEqual(hvoExpected, foundLocation.TopLevelHvo);
     Assert.AreEqual(StTextTags.kflidParagraphs, foundLocation.m_location[0].tag);
     Assert.AreEqual(StTxtParaTags.kflidContents, foundLocation.m_tag);
     Assert.AreEqual(ichMinExpected, foundLocation.m_ichMin);
     Assert.AreEqual(ichLimExpected, foundLocation.m_ichLim);
     m_sel = foundLocation;
 }