Пример #1
0
        public void SetUp()
        {
            CheckDisposed();

            if (m_emptyTsString != null)
            {
                Marshal.ReleaseComObject(m_emptyTsString);
            }
            // Create an empty TsString
            ITsStrBldr bldr = TsStrBldrClass.Create();

            bldr.Replace(0, 0, string.Empty, null);
            m_emptyTsString = bldr.GetString();

            // Set up the FDO mock and populate it with some values
            m_inMemoryCache = ScrInMemoryFdoCache.Create();
            m_inMemoryCache.InitializeLangProject();
            m_inMemoryCache.InitializeScripture();
            m_book = m_inMemoryCache.AddBookToMockedScripture(57, "Philemon");

            // Set up IVwEnv object
            m_vwenvMock = new DynamicMock(typeof(IVwEnv));
            m_vwenvMock.SetupResult("DataAccess", m_inMemoryCache.CacheAccessor);

            // save settings
            m_oldPromptSetting = Options.ShowEmptyParagraphPromptsSetting;
        }
Пример #2
0
        public void Init()
        {
            m_inMemoryCache = ScrInMemoryFdoCache.Create(this);
            m_inMemoryCache.InitializeLangProject();
            m_inMemoryCache.InitializeScripture();
            m_inMemoryCache.AddBookToMockedScripture(1, "Genesis");
            m_inMemoryCache.AddBookToMockedScripture(2, "Exodus");
            m_inMemoryCache.AddBookToMockedScripture(5, "Deuteronomy");
            m_James = m_inMemoryCache.AddBookToMockedScripture(59, "James");
            m_inMemoryCache.AddBookToMockedScripture(66, "Revelation");
            m_fdoCache = m_inMemoryCache.Cache;

            m_scr = (Scripture)m_fdoCache.LangProject.TranslatedScriptureOA;

            m_ctrlOwner = new Form();

            ILgWritingSystemFactory wsf = m_fdoCache.LanguageWritingSystemFactoryAccessor;

            m_scp   = new DummyScrPassageControl(null, m_scr, false);
            m_dbScp = new DummyScrPassageControl(null, m_scr, true);

            m_ctrlOwner.Controls.Add(m_scp);
            m_ctrlOwner.Controls.Add(m_dbScp);
            m_ctrlOwner.CreateControl();

            if (m_scp.DropDownWindow != null)
            {
                m_scp.DropDownWindow.Close();
            }

            if (m_dbScp.DropDownWindow != null)
            {
                m_dbScp.DropDownWindow.Close();
            }

            // Forcing the reference to this should reset the ScrReference object for us
            // which, we hope will cause some strange errors to occur when running in
            // console mode. The tests seem to always work in gui mode but not console mode.
            m_scp.ScReference   = new ScrReference(01001001, m_scr.Versification);
            m_dbScp.ScReference = new ScrReference(01001001, m_scr.Versification);
        }
Пример #3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Creates a book (Exodus) with 3 sections with the following layout:
        ///
        ///			(Exodus)
        ///		   Heading 1
        ///	Intro text
        ///		   Heading 2
        ///	(1)1Verse one. 2Verse two.
        ///	3Verse three.
        ///	4Verse four. 5Verse five.
        ///		   Heading 3
        ///	6Verse six. 7Verse seven.
        ///
        ///	(1) = chapter number 1
        /// </summary>
        /// <returns>the book of Exodus for testing</returns>
        /// ------------------------------------------------------------------------------------
        protected IScrBook CreateExodusData()
        {
            IScrBook book = m_scrInMemoryCache.AddBookToMockedScripture(2, "Exodus");

            m_scrInMemoryCache.AddTitleToMockedBook(book.Hvo, "Exodus");

            IScrSection section1 = m_scrInMemoryCache.AddIntroSectionToMockedBook(book.Hvo);

            m_scrInMemoryCache.AddSectionHeadParaToSection(section1.Hvo, "Heading 1", ScrStyleNames.IntroSectionHead);
            StTxtPara para11 = m_scrInMemoryCache.AddParaToMockedSectionContent(section1.Hvo, ScrStyleNames.IntroParagraph);

            m_scrInMemoryCache.AddRunToMockedPara(para11, "Intro text. We need lots of stuff here so that our footnote tests will work.", null);
            section1.AdjustReferences();

            IScrSection section2 = m_scrInMemoryCache.AddSectionToMockedBook(book.Hvo);

            m_scrInMemoryCache.AddSectionHeadParaToSection(section2.Hvo, "Heading 2", ScrStyleNames.SectionHead);
            StTxtPara para21 = m_scrInMemoryCache.AddParaToMockedSectionContent(section2.Hvo, ScrStyleNames.NormalParagraph);

            m_scrInMemoryCache.AddRunToMockedPara(para21, "1", ScrStyleNames.ChapterNumber);
            m_scrInMemoryCache.AddRunToMockedPara(para21, "1", ScrStyleNames.VerseNumber);
            m_scrInMemoryCache.AddRunToMockedPara(para21, "Verse one. ", null);
            m_scrInMemoryCache.AddRunToMockedPara(para21, "2", ScrStyleNames.VerseNumber);
            m_scrInMemoryCache.AddRunToMockedPara(para21, "Verse two.", null);

            StTxtPara para22 = m_scrInMemoryCache.AddParaToMockedSectionContent(section2.Hvo, ScrStyleNames.NormalParagraph);

            m_scrInMemoryCache.AddRunToMockedPara(para22, "3", ScrStyleNames.VerseNumber);
            m_scrInMemoryCache.AddRunToMockedPara(para22, "Verse three.", null);

            StTxtPara para23 = m_scrInMemoryCache.AddParaToMockedSectionContent(section2.Hvo, ScrStyleNames.NormalParagraph);

            m_scrInMemoryCache.AddRunToMockedPara(para23, "4", ScrStyleNames.VerseNumber);
            m_scrInMemoryCache.AddRunToMockedPara(para23, "Verse four. ", null);
            m_scrInMemoryCache.AddRunToMockedPara(para23, "5", ScrStyleNames.VerseNumber);
            m_scrInMemoryCache.AddRunToMockedPara(para23, "Verse five.", null);
            section2.AdjustReferences();

            IScrSection section3 = m_scrInMemoryCache.AddSectionToMockedBook(book.Hvo);

            m_scrInMemoryCache.AddSectionHeadParaToSection(section3.Hvo, "Heading 3", ScrStyleNames.SectionHead);
            StTxtPara para31 = m_scrInMemoryCache.AddParaToMockedSectionContent(section3.Hvo, ScrStyleNames.NormalParagraph);

            m_scrInMemoryCache.AddRunToMockedPara(para31, "6", ScrStyleNames.VerseNumber);
            m_scrInMemoryCache.AddRunToMockedPara(para31, "Verse six. ", null);
            m_scrInMemoryCache.AddRunToMockedPara(para31, "7", ScrStyleNames.VerseNumber);
            m_scrInMemoryCache.AddRunToMockedPara(para31, "Verse seven.", null);
            section3.AdjustReferences();

            return(book);
        }