public void RecordError_Duplicate() { ScrChecksDataSource dataSource = new ScrChecksDataSource(Cache); DummyEditorialCheck check = new DummyEditorialCheck(kCheckId1); ScrCheckingToken tok = new DummyParaCheckingToken(m_scr, Cache.DefaultVernWs, 0); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 5, 8, "Lousy message")); m_scrInMemoryCache.AddBookToMockedScripture(tok.StartRef.Book, "My Favorite Book"); dataSource.GetText(tok.StartRef.Book, 0); dataSource.RunCheck(check); IScrBookAnnotations annotations = m_scr.BookAnnotationsOS[tok.StartRef.Book - 1]; Assert.AreEqual(1, annotations.NotesOS.Count, "First run of check should add error annotation"); dataSource.RunCheck(check); Assert.AreEqual(1, annotations.NotesOS.Count, "Second run of check shouldn't create a duplicate."); }
public void RecordError_NearDuplicate_DifferByCheck() { ScrChecksDataSource dataSource = new ScrChecksDataSource(Cache); ICmAnnotationDefn annDefnChkError = new CmAnnotationDefn(Cache, LangProject.kguidAnnCheckingError); CmAnnotationDefn errorCheck1 = new CmAnnotationDefn(); annDefnChkError.SubPossibilitiesOS.Append(errorCheck1); errorCheck1.Guid = Guid.NewGuid(); errorCheck1.Name.UserDefaultWritingSystem = "Type 1"; CmAnnotationDefn errorCheck2 = new CmAnnotationDefn(); annDefnChkError.SubPossibilitiesOS.Append(errorCheck2); errorCheck2.Guid = Guid.NewGuid(); errorCheck2.Name.UserDefaultWritingSystem = "Type 2"; DummyEditorialCheck check1 = new DummyEditorialCheck(errorCheck1.Guid); ScrCheckingToken tok = new DummyParaCheckingToken(m_scr, Cache.DefaultVernWs, 0); check1.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 5, 8, "General Error")); m_scrInMemoryCache.AddBookToMockedScripture(tok.StartRef.Book, "My Favorite Book"); dataSource.GetText(tok.StartRef.Book, 0); dataSource.RunCheck(check1); IScrBookAnnotations annotations = m_scr.BookAnnotationsOS[tok.StartRef.Book - 1]; Assert.AreEqual(1, annotations.NotesOS.Count, "Check 1 should add 1 error annotation"); IScrScriptureNote origErrorAnnotation = annotations.NotesOS[0]; DummyEditorialCheck check2 = new DummyEditorialCheck(errorCheck2.Guid); check2.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 5, 8, "General Error")); dataSource.RunCheck(check2); Assert.AreEqual(2, annotations.NotesOS.Count, "Check 2 should add another error annotation."); Assert.IsTrue(annotations.NotesOS.Contains(origErrorAnnotation)); }
public void RecordError_NearDuplicate_DifferByCitedText() { ScrChecksDataSource dataSource = new ScrChecksDataSource(Cache); DummyEditorialCheck check = new DummyEditorialCheck(kCheckId1); ScrCheckingToken tok = new DummyParaCheckingToken(m_scr, Cache.DefaultVernWs, 0); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 0, 4, "Message")); m_scrInMemoryCache.AddBookToMockedScripture(tok.StartRef.Book, "My Favorite Book"); dataSource.GetText(tok.StartRef.Book, 0); dataSource.RunCheck(check); IScrBookAnnotations annotations = m_scr.BookAnnotationsOS[tok.StartRef.Book - 1]; Assert.AreEqual(1, annotations.NotesOS.Count, "First run of check should add 1 error annotation"); IScrScriptureNote origErrorAnnotation = annotations.NotesOS[0]; check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 5, 8, "Message")); dataSource.RunCheck(check); Assert.AreEqual(2, annotations.NotesOS.Count, "Second run of check should add another error annotation."); Assert.IsTrue(annotations.NotesOS.Contains(origErrorAnnotation)); }
public void RunCheck_CorrectedErrorGetsDeleted() { ScrChecksDataSource dataSource = new ScrChecksDataSource(Cache); DummyEditorialCheck check = new DummyEditorialCheck(kCheckId1); ScrCheckingToken tok = new DummyParaCheckingToken(m_scr, Cache.DefaultVernWs, 0); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 5, 8, "Lousy message")); m_scrInMemoryCache.AddBookToMockedScripture(tok.StartRef.Book, "My Favorite Book"); dataSource.GetText(tok.StartRef.Book, 0); dataSource.RunCheck(check); IScrBookAnnotations annotations = m_scr.BookAnnotationsOS[tok.StartRef.Book - 1]; Assert.AreEqual(1, annotations.NotesOS.Count, "First run of check should add 1 error annotation"); IScrScriptureNote origErrorAnnotation = annotations.NotesOS[0]; Assert.AreEqual("Lousy message", ((StTxtPara)origErrorAnnotation.DiscussionOA.ParagraphsOS[0]).Contents.Text); check.m_ErrorsToReport.Clear(); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 5, 8, "Goofy message")); dataSource.RunCheck(check); Assert.AreEqual(1, annotations.NotesOS.Count, "Second run of check should delete the 'fixed' error annotation and add another error annotation."); IScrScriptureNote newErrorAnnotation = annotations.NotesOS[0]; Assert.AreNotEqual(origErrorAnnotation, newErrorAnnotation); Assert.AreEqual("Goofy message", ((StTxtPara)newErrorAnnotation.DiscussionOA.ParagraphsOS[0]).Contents.Text); }
public void RecordError_NearDuplicate_DifferOnlyByParaHvo() { IScrBook book = m_scrInMemoryCache.AddBookToMockedScripture(1, "My Favorite Book"); BCVRef reference = new BCVRef(1, 2, 3); ScrChecksDataSource dataSource = new ScrChecksDataSource(Cache); DummyEditorialCheck check = new DummyEditorialCheck(kCheckId1); ScrCheckingToken tok = new DummyParaCheckingToken(book, Cache.DefaultVernWs, 0, reference, reference); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 5, 8, "Message")); dataSource.GetText(tok.StartRef.Book, 0); dataSource.RunCheck(check); IScrBookAnnotations annotations = m_scr.BookAnnotationsOS[tok.StartRef.Book - 1]; Assert.AreEqual(1, annotations.NotesOS.Count, "First run of check should add 1 error annotation"); IScrScriptureNote origErrorAnnotation = annotations.NotesOS[0]; IScrDraft draft = m_scr.ArchivedDraftsOC.Add(new ScrDraft()); draft.BooksOS.Append(book); Assert.AreEqual(0, m_scr.ScriptureBooksOS.Count); check.m_ErrorsToReport.Clear(); IScrBook newBook = m_scrInMemoryCache.AddBookToMockedScripture(1, "My Favorite Book"); tok = new DummyParaCheckingToken(newBook, Cache.DefaultVernWs, 0, reference, reference); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 5, 8, "Message")); dataSource.RunCheck(check); Assert.AreEqual(1, annotations.NotesOS.Count, "Second run of check should add another error annotation."); Assert.IsTrue(annotations.NotesOS.Contains(origErrorAnnotation)); Assert.AreEqual(newBook.Hvo, annotations.NotesOS[0].BeginObjectRAHvo); Assert.AreEqual(newBook.Hvo, annotations.NotesOS[0].EndObjectRAHvo); Assert.AreEqual(reference, annotations.NotesOS[0].BeginRef); Assert.AreEqual(reference, annotations.NotesOS[0].EndRef); Assert.AreEqual(5, annotations.NotesOS[0].BeginOffset); Assert.AreEqual(13, annotations.NotesOS[0].EndOffset); }
public void RunCheck_ScrCheckRunRecordsWithFixedInconsistency() { ScrChecksDataSource dataSource = new ScrChecksDataSource(Cache); DummyEditorialCheck check = new DummyEditorialCheck(kCheckId1); ScrCheckingToken tok = new DummyParaCheckingToken(m_scr, Cache.DefaultVernWs, 0); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 5, 2, "Verbification")); m_scrInMemoryCache.AddBookToMockedScripture(tok.StartRef.Book, "The Book of David"); dataSource.GetText(tok.StartRef.Book, 0); dataSource.RunCheck(check); IScrBookAnnotations annotations = m_scr.BookAnnotationsOS[tok.StartRef.Book - 1]; Assert.AreEqual(1, annotations.ChkHistRecsOC.Count); Assert.AreEqual(1, annotations.NotesOS.Count); ScrCheckRun scr = new ScrCheckRun(Cache, annotations.ChkHistRecsOC.HvoArray[0]); Assert.AreEqual(ScrCheckRunResult.Inconsistencies, scr.Result); Assert.AreEqual(NoteStatus.Open, annotations.NotesOS[0].ResolutionStatus); check.m_ErrorsToReport.Clear(); dataSource.RunCheck(check); Assert.AreEqual(1, annotations.ChkHistRecsOC.Count); Assert.AreEqual(0, annotations.NotesOS.Count); scr = new ScrCheckRun(Cache, annotations.ChkHistRecsOC.HvoArray[0]); Assert.AreEqual(ScrCheckRunResult.NoInconsistencies, scr.Result); }
public void RunCheck_ScrCheckRunRecordsWithOneBookTwoChecks() { ScrChecksDataSource dataSource = new ScrChecksDataSource(Cache); DummyEditorialCheck check1 = new DummyEditorialCheck(kCheckId1); ScrCheckingToken tok = new DummyParaCheckingToken(m_scr, Cache.DefaultVernWs, 0); check1.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 5, 2, "Verbification")); tok = new DummyParaCheckingToken(m_scr, m_inMemoryCache.Cache.DefaultVernWs, 0); check1.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 26, 2, "Verbification")); DummyEditorialCheck check2 = new DummyEditorialCheck(kCheckId2); check2.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 5, 2, "Stupid Check")); tok = new DummyParaCheckingToken(m_scr, m_inMemoryCache.Cache.DefaultVernWs, 0); check2.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 26, 2, "Stupid Check")); m_scrInMemoryCache.AddBookToMockedScripture(tok.StartRef.Book, "The Book of David"); dataSource.GetText(tok.StartRef.Book, 0); dataSource.RunCheck(check1); dataSource.RunCheck(check2); IScrBookAnnotations annotations = m_scr.BookAnnotationsOS[tok.StartRef.Book - 1]; Assert.AreEqual(2, annotations.ChkHistRecsOC.Count); Assert.AreEqual(4, annotations.NotesOS.Count); ScrCheckRun scr1 = new ScrCheckRun(Cache, annotations.ChkHistRecsOC.HvoArray[0]); ScrCheckRun scr2 = new ScrCheckRun(Cache, annotations.ChkHistRecsOC.HvoArray[1]); Assert.AreEqual(ScrCheckRunResult.Inconsistencies, scr1.Result); Assert.AreEqual(ScrCheckRunResult.Inconsistencies, scr2.Result); Assert.AreEqual(NoteStatus.Open, annotations.NotesOS[0].ResolutionStatus); Assert.AreEqual(NoteStatus.Open, annotations.NotesOS[1].ResolutionStatus); Assert.AreEqual(NoteStatus.Open, annotations.NotesOS[2].ResolutionStatus); Assert.AreEqual(NoteStatus.Open, annotations.NotesOS[3].ResolutionStatus); annotations.NotesOS[0].ResolutionStatus = NoteStatus.Closed; annotations.NotesOS[1].ResolutionStatus = NoteStatus.Closed; dataSource.RunCheck(check1); scr1 = new ScrCheckRun(Cache, annotations.ChkHistRecsOC.HvoArray[0]); scr2 = new ScrCheckRun(Cache, annotations.ChkHistRecsOC.HvoArray[1]); Assert.AreEqual(ScrCheckRunResult.IgnoredInconsistencies, scr1.Result); Assert.AreEqual(ScrCheckRunResult.Inconsistencies, scr2.Result); }
public void RecordError_ErrorMaxIncreased() { // Setup a data source with a limit of one identical error for all checks. // Setup three identical checking errors. DummyScrChecksDataSource dataSource = new DummyScrChecksDataSource(Cache, 1); DummyEditorialCheck check = new DummyEditorialCheck(kCheckId1); ScrCheckingToken tok = new DummyParaCheckingToken(m_scr, Cache.DefaultVernWs, 0); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 5, 2, "identical")); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 26, 2, "identical")); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 37, 2, "identical")); m_scrInMemoryCache.AddBookToMockedScripture(tok.StartRef.Book, "My Favorite Book"); // Run the Scripture check dataSource.GetText(tok.StartRef.Book, 0); dataSource.RunCheck(check); IScrBookAnnotations annotations = m_scr.BookAnnotationsOS[tok.StartRef.Book - 1]; Assert.AreEqual(2, annotations.NotesOS.Count, "Two error annotations should have been added: one error and one maximum exceeded msg."); // Now update the maximum identical errors to be unlimited and run the check again. dataSource.MaxIdenticalErrors = -1; dataSource.GetText(tok.StartRef.Book, 0); dataSource.RunCheck(check); // We expect three error annotations and we confirm the last error. Assert.AreEqual(3, annotations.NotesOS.Count, "There should be three error annotations now."); IScrScriptureNote note = annotations.NotesOS[2]; Assert.AreEqual("identical", ((StTxtPara)note.DiscussionOA.ParagraphsOS[0]).Contents.Text); Assert.AreEqual("is", ((StTxtPara)note.QuoteOA.ParagraphsOS[0]).Contents.Text); }
public void RecordError_Duplicate_SameErrorTwiceInVerse() { ScrChecksDataSource dataSource = new ScrChecksDataSource(Cache); DummyEditorialCheck check = new DummyEditorialCheck(kCheckId1); ScrCheckingToken tok = new DummyParaCheckingToken(m_scr, Cache.DefaultVernWs, 0); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 5, 2, "Lousy message")); tok = new DummyParaCheckingToken(m_scr, m_inMemoryCache.Cache.DefaultVernWs, 0); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 26, 2, "Lousy message")); m_scrInMemoryCache.AddBookToMockedScripture(tok.StartRef.Book, "My Favorite Book"); dataSource.GetText(tok.StartRef.Book, 0); dataSource.RunCheck(check); IScrBookAnnotations annotations = m_scr.BookAnnotationsOS[tok.StartRef.Book - 1]; Assert.AreEqual(2, annotations.NotesOS.Count, "First run of check should add two error annotations"); Assert.AreEqual(5, annotations.NotesOS[0].BeginOffset); Assert.AreEqual(26, annotations.NotesOS[1].BeginOffset); Assert.AreEqual(28, annotations.NotesOS[1].EndOffset); // Change the offset of the second error (but the text is still the same at that ich, so the // error's key will be the same). check.m_ErrorsToReport[1].m_ichStart = 37; dataSource.RunCheck(check); Assert.AreEqual(2, annotations.NotesOS.Count, "Second run of check shouldn't create a duplicate."); Assert.AreEqual(5, annotations.NotesOS[0].BeginOffset, "Offset of first annotation shouldn't change."); Assert.AreEqual(37, annotations.NotesOS[1].BeginOffset, "Begin offset of second annotation should get updated."); Assert.AreEqual(39, annotations.NotesOS[1].EndOffset, "End offset of second annotation should get updated."); }
public void RecordError_ErrorMaxDecreased() { // Setup a data source that does not set a limit on identical errors for all checks. // Setup three identical checking errors. DummyScrChecksDataSource dataSource = new DummyScrChecksDataSource(Cache, -1); DummyEditorialCheck check = new DummyEditorialCheck(kCheckId1); ScrCheckingToken tok = new DummyParaCheckingToken(m_scr, Cache.DefaultVernWs, 0); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 5, 2, "identical")); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 26, 2, "identical")); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 37, 2, "identical")); m_scrInMemoryCache.AddBookToMockedScripture(tok.StartRef.Book, "My Favorite Book"); // Run the Scripture check dataSource.GetText(tok.StartRef.Book, 0); dataSource.RunCheck(check); IScrBookAnnotations annotations = m_scr.BookAnnotationsOS[tok.StartRef.Book - 1]; Assert.AreEqual(3, annotations.NotesOS.Count, "Three error annotations should have been added."); // Now update the maximum identical errors to only 1 and run the check again. dataSource.MaxIdenticalErrors = 1; dataSource.GetText(tok.StartRef.Book, 0); dataSource.RunCheck(check); // We expect two error annotations: one for the only allowed error and // one indicating that a maximum has been exceeded. Assert.AreEqual(2, annotations.NotesOS.Count, "There should be two error annotations now."); IScrScriptureNote note = annotations.NotesOS[0]; Assert.AreEqual("identical", ((StTxtPara)note.DiscussionOA.ParagraphsOS[0]).Contents.Text); Assert.AreEqual("is", ((StTxtPara)note.QuoteOA.ParagraphsOS[0]).Contents.Text); IScrScriptureNote maxNote = annotations.NotesOS[1]; Assert.AreEqual("Maximum number of Dummy Check 1 errors exceeded.", ((StTxtPara)maxNote.DiscussionOA.ParagraphsOS[0]).Contents.Text); Assert.AreEqual("is", ((StTxtPara)maxNote.QuoteOA.ParagraphsOS[0]).Contents.Text); }
public void RecordError_ErrorsWithNoMax() { // Setup a data source that does not set a limit on identical errors for all checks. // Setup three identical checking errors. DummyScrChecksDataSource dataSource = new DummyScrChecksDataSource(Cache, -1); DummyEditorialCheck check = new DummyEditorialCheck(kCheckId1); ScrCheckingToken tok = new DummyParaCheckingToken(m_scr, Cache.DefaultVernWs, 0); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 5, 2, "identical")); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 26, 2, "identical")); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 37, 2, "identical")); m_scrInMemoryCache.AddBookToMockedScripture(tok.StartRef.Book, "My Favorite Book"); // Run the Scripture check dataSource.GetText(tok.StartRef.Book, 0); dataSource.RunCheck(check); // We expect three identical error annotations to be created. IScrBookAnnotations annotations = m_scr.BookAnnotationsOS[tok.StartRef.Book - 1]; Assert.AreEqual(3, annotations.NotesOS.Count, "Three error annotations should have been added."); // verify allowed identical annotations for (int iNote = 0; iNote < 3; iNote++) { // verify allowed identical annotations IScrScriptureNote note = annotations.NotesOS[iNote]; Assert.AreEqual("identical", ((StTxtPara)note.DiscussionOA.ParagraphsOS[0]).Contents.Text); Assert.AreEqual("is", ((StTxtPara)note.QuoteOA.ParagraphsOS[0]).Contents.Text); } }
public void RecordError_ErrorsAlmostIdentical2() { // Setup a data source that warns the user on the second identical error that they // have exceeded the maximum. // Setup three identical checking errors. DummyScrChecksDataSource dataSource = new DummyScrChecksDataSource(Cache, 1); DummyEditorialCheck check = new DummyEditorialCheck(kCheckId1); ScrCheckingToken tok = new DummyParaCheckingToken(m_scr, Cache.DefaultVernWs, 0); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 5, 2, "identical")); // For this second error report, the message is different. check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 26, 2, "different")); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 37, 2, "identical")); m_scrInMemoryCache.AddBookToMockedScripture(tok.StartRef.Book, "My Favorite Book"); // Run the Scripture check dataSource.GetText(tok.StartRef.Book, 0); dataSource.RunCheck(check); // We expect three error annotations to be created: one for the only allowed error, // one with a message that is different, and one indicating that a maximum has been // exceeded. The cited text is identical in all three annotations. IScrBookAnnotations annotations = m_scr.BookAnnotationsOS[tok.StartRef.Book - 1]; Assert.AreEqual(3, annotations.NotesOS.Count, "Three error annotations should have been added."); // verify allowed identical annotations IScrScriptureNote note = annotations.NotesOS[0]; Assert.AreEqual("identical", ((StTxtPara)note.DiscussionOA.ParagraphsOS[0]).Contents.Text); Assert.AreEqual("is", ((StTxtPara)note.QuoteOA.ParagraphsOS[0]).Contents.Text); note = annotations.NotesOS[1]; Assert.AreEqual("different", ((StTxtPara)note.DiscussionOA.ParagraphsOS[0]).Contents.Text); Assert.AreEqual("is", ((StTxtPara)note.QuoteOA.ParagraphsOS[0]).Contents.Text); // verify identical error exceeded annotation. IScrScriptureNote maxNote = annotations.NotesOS[2]; Assert.AreEqual("Maximum number of Dummy Check 1 errors exceeded.", ((StTxtPara)maxNote.DiscussionOA.ParagraphsOS[0]).Contents.Text); Assert.AreEqual("is", ((StTxtPara)maxNote.QuoteOA.ParagraphsOS[0]).Contents.Text); }
public void RecordError_ErrorsIdentical() { // Setup a data source that allows a maximum of two identical errors for all checks. // Setup three identical checking errors. DummyScrChecksDataSource dataSource = new DummyScrChecksDataSource(Cache, 2); DummyEditorialCheck check = new DummyEditorialCheck(kCheckId1); ScrCheckingToken tok = new DummyParaCheckingToken(m_scr, Cache.DefaultVernWs, 0); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 5, 2, "identical")); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 26, 2, "identical")); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 37, 2, "identical")); m_scrInMemoryCache.AddBookToMockedScripture(tok.StartRef.Book, "My Favorite Book"); // Run the Scripture check dataSource.GetText(tok.StartRef.Book, 0); dataSource.RunCheck(check); // We expect three error annotations to be created: two for the allowed identical errors, // and one indicating that a maximum has been exceeded. IScrBookAnnotations annotations = m_scr.BookAnnotationsOS[tok.StartRef.Book - 1]; Assert.AreEqual(3, annotations.NotesOS.Count, "Three error annotations should have been added."); for (int iNote = 0; iNote < 2; iNote++) { // verify allowed identical annotations IScrScriptureNote note = annotations.NotesOS[iNote]; Assert.AreEqual("identical", ((StTxtPara)note.DiscussionOA.ParagraphsOS[0]).Contents.Text); Assert.AreEqual("is", ((StTxtPara)note.QuoteOA.ParagraphsOS[0]).Contents.Text); } // verify identical error exceeded annotation. IScrScriptureNote maxNote = annotations.NotesOS[2]; Assert.AreEqual("Maximum number of Dummy Check 1 errors exceeded.", ((StTxtPara)maxNote.DiscussionOA.ParagraphsOS[0]).Contents.Text); Assert.AreEqual("is", ((StTxtPara)maxNote.QuoteOA.ParagraphsOS[0]).Contents.Text); }
public void RecordError_DuplicateAfterAdjustingReference() { ScrChecksDataSource dataSource = new ScrChecksDataSource(Cache); DummyEditorialCheck check = new DummyEditorialCheck(kCheckId1); ScrCheckingToken tok = new DummyParaCheckingToken(m_scr, Cache.DefaultVernWs, 0); tok.MissingStartRef = new BCVRef(tok.StartRef); tok.MissingStartRef.Verse++; tok.MissingEndRef = new BCVRef(tok.MissingStartRef); tok.MissingEndRef.Verse++; // this simulates missing two verses check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 1, 1, "3")); m_scrInMemoryCache.AddBookToMockedScripture(tok.StartRef.Book, "My Favorite Book"); dataSource.GetText(tok.StartRef.Book, 0); dataSource.RunCheck(check); IScrBookAnnotations annotations = m_scr.BookAnnotationsOS[tok.StartRef.Book - 1]; Assert.AreEqual(1, annotations.NotesOS.Count, "First run of check should add error annotation"); annotations.NotesOS[0].ResolutionStatus = NoteStatus.Closed; // Need a new token because the one above has already gotten changed. tok = new DummyParaCheckingToken(m_scr, Cache.DefaultVernWs, 0); tok.MissingStartRef = new BCVRef(tok.StartRef); tok.MissingStartRef.Verse++; tok.MissingEndRef = new BCVRef(tok.MissingStartRef); tok.MissingEndRef.Verse++; // this simulates missing two verses check.m_ErrorsToReport.Clear(); check.m_ErrorsToReport.Add(new DummyEditorialCheck.DummyError(tok, 1, 1, "3")); dataSource.RunCheck(check); Assert.AreEqual(1, annotations.NotesOS.Count, "Second run of check shouldn't create a duplicate."); Assert.AreEqual(NoteStatus.Closed, annotations.NotesOS[0].ResolutionStatus, "Annotation should still be resolved/closed (ignored)."); }