예제 #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Add an annotation to a language project.
        /// </summary>
        /// <param name="testBase">in-memory cache to use for testing</param>
        /// <param name="noteText">text to include in discussion</param>
        /// <param name="startRef"></param>
        /// <param name="endRef"></param>
        /// <param name="topPara">Begin IStTxtPara to annotate</param>
        /// <param name="bottomPara">End IStTxtPara to annotate</param>
        /// <returns>a new annotation</returns>
        /// ------------------------------------------------------------------------------------
        internal static IScrScriptureNote AddAnnotation(ScrInMemoryFdoTestBase testBase, string noteText,
                                                        ScrReference startRef, ScrReference endRef, ICmObject topPara, ICmObject bottomPara)
        {
            ILangProject        lp          = testBase.Cache.LangProject;
            IScrBookAnnotations annotations = lp.TranslatedScriptureOA.BookAnnotationsOS[startRef.Book - 1];
            IScrScriptureNote   note        = annotations.InsertNote(startRef, endRef, topPara, bottomPara,
                                                                     StandardNoteType(testBase.Cache).Guid);

            IStTxtPara discussionPara = (IStTxtPara)note.DiscussionOA.ParagraphsOS[0];

            testBase.AddRunToMockedPara(discussionPara, noteText, testBase.Cache.DefaultAnalWs);

            note.DateCreated = new DateTime(s_Ticks++);

            return(note);
        }
예제 #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Append a new section to the given book, having the specified text as the section
        /// head. The new section will have an empty content text created also.
        /// </summary>
        /// <param name="testBase">in-memory test base to use for testing</param>
        /// <param name="book">The book to which the section is to be appended</param>
        /// <param name="sSectionHead">The text of the new section head. Can be a simple string
        /// or a format string. (See CreateText for the definition of the format string)</param>
        /// <param name="paraStyleName">paragraph style to apply to the section head</param>
        /// <returns>The newly created section</returns>
        /// ------------------------------------------------------------------------------------
        internal static IScrSection CreateSection(ScrInMemoryFdoTestBase testBase, IScrBook book,
                                                  string sSectionHead, string paraStyleName)
        {
            // Create a section
            bool        fIsIntro = (paraStyleName.Equals(ScrStyleNames.IntroSectionHead));
            IScrSection section  = testBase.AddSectionToMockedBook(book, fIsIntro);

            // Create a heading paragraph with text
            string styleName = !string.IsNullOrEmpty(paraStyleName) ? paraStyleName :
                               ScrStyleNames.SectionHead;
            IStTxtPara para = section.HeadingOA.AddNewTextPara(styleName);

            if (!string.IsNullOrEmpty(sSectionHead) && sSectionHead[0] == '\\')
            {
                // Text is formatted so add it as a formatted string.
                testBase.AddFormatTextToMockedPara(book, para, sSectionHead, testBase.Cache.DefaultVernWs);
            }
            else
            {
                testBase.AddRunToMockedPara(para, sSectionHead, testBase.Cache.DefaultVernWs);
            }

            return(section);
        }