public void MigrateDeprecatedCharacterIds_FirstVerseInQuoteIsUnexpectedForCharacter_CharacterIdNotSetToUnknown() { var testProject = TestProject.CreateTestProject(TestProject.TestBook.JUD); TestProject.SimulateDisambiguationForAllBooks(testProject); var bookScript = testProject.IncludedBooks.Single(); var verses13and14Block = bookScript.GetBlocksForVerse(1, 13).Single(); var originalVerse14Blocks = bookScript.GetBlocksForVerse(1, 14); // Use reflection to get around a check to ensure we don't do this in production code List <Block> blocks = (List <Block>)ReflectionHelper.GetField(bookScript, "m_blocks"); int blockCount = (int)ReflectionHelper.GetField(bookScript, "m_blockCount"); //Combine verse 13 and 14 blocks foreach (var block in originalVerse14Blocks) { verses13and14Block.BlockElements.AddRange(block.BlockElements); blocks.Remove(block); blockCount--; } ReflectionHelper.SetField(bookScript, "m_blockCount", blockCount); verses13and14Block.CharacterId = "Enoch"; //Setup check Assert.AreEqual("Enoch", verses13and14Block.CharacterId); //SUT Assert.AreEqual(0, ProjectDataMigrator.MigrateDeprecatedCharacterIds(testProject)); Assert.AreEqual("Enoch", verses13and14Block.CharacterId); }
public void MigrateInvalidCharacterIdForScriptDataToVersion88_CharacterIdUnclearAndCharacterIdInScriptNotNull_CharacterIdInScriptSetToNull(string unclearCharacterId) { var block1 = CreateTestBlock("Andrew"); block1.UserConfirmed = true; block1.CharacterId = unclearCharacterId; Assert.AreEqual(unclearCharacterId, block1.CharacterId); Assert.AreEqual("Andrew", block1.CharacterIdInScript); var block2 = CreateTestBlock("Peter"); block2.UserConfirmed = true; block2.CharacterId = unclearCharacterId; Assert.AreEqual(unclearCharacterId, block2.CharacterId); Assert.AreEqual("Peter", block2.CharacterIdInScript); var book = new BookScript("MAT", new List <Block> { block1, block2 }); var books = new List <BookScript> { book }; Assert.True(block1.UserConfirmed); Assert.True(block2.UserConfirmed); ProjectDataMigrator.MigrateInvalidCharacterIdForScriptData(books); Assert.AreEqual(unclearCharacterId, block1.CharacterId); Assert.AreEqual(unclearCharacterId, block1.CharacterIdInScript); Assert.False(block1.UserConfirmed); Assert.AreEqual(unclearCharacterId, block2.CharacterId); Assert.AreEqual(unclearCharacterId, block2.CharacterIdInScript); Assert.False(block2.UserConfirmed); }
public void CleanUpOrphanedMultiBlockQuoteStati_NoneFollowedByMultipleNonStarts_NonStartsChangedToNone() { var block1 = CreateTestBlock(1, MultiBlockQuote.None); var block2 = CreateTestBlock(2, MultiBlockQuote.Continuation); var block3 = CreateTestBlock(3, MultiBlockQuote.Continuation); var block1Original = block1.Clone(); var block2Original = block2.Clone(); var block3Original = block3.Clone(); var book = new BookScript("MAT", new List <Block> { block1, block2, block3 }); var books = new List <BookScript> { book }; ProjectDataMigrator.CleanUpOrphanedMultiBlockQuoteStati(books); Assert.AreEqual(3, book.Blocks.Count); Assert.AreEqual(block1Original.GetText(true), block1.GetText(true)); Assert.AreEqual(block2Original.GetText(true), block2.GetText(true)); Assert.AreEqual(block3Original.GetText(true), block3.GetText(true)); Assert.AreEqual(MultiBlockQuote.None, block1.MultiBlockQuote); Assert.AreEqual(MultiBlockQuote.None, block2.MultiBlockQuote); Assert.AreEqual(MultiBlockQuote.None, block3.MultiBlockQuote); }
public void CleanUpOrphanedMultiBlockQuoteStati_TwoStarts_FirstStartChangedToNone(MultiBlockQuote continuingStatus) { var block1 = CreateTestBlock(1, MultiBlockQuote.None); var block2 = CreateTestBlock(2, MultiBlockQuote.Start); var block3 = CreateTestBlock(3, MultiBlockQuote.Start); var block4 = CreateTestBlock(4, continuingStatus); var block1Original = block1.Clone(); var block2Original = block2.Clone(); var block3Original = block3.Clone(); var block4Original = block4.Clone(); var book = new BookScript("MAT", new List <Block> { block1, block2, block3, block4 }); var books = new List <BookScript> { book }; ProjectDataMigrator.CleanUpOrphanedMultiBlockQuoteStati(books); Assert.AreEqual(4, book.Blocks.Count); Assert.AreEqual(block1Original.GetText(true), block1.GetText(true)); Assert.AreEqual(block2Original.GetText(true), block2.GetText(true)); Assert.AreEqual(block3Original.GetText(true), block3.GetText(true)); Assert.AreEqual(block4Original.GetText(true), block4.GetText(true)); Assert.AreEqual(MultiBlockQuote.None, block1.MultiBlockQuote); Assert.AreEqual(MultiBlockQuote.None, block2.MultiBlockQuote); Assert.AreEqual(MultiBlockQuote.Start, block3.MultiBlockQuote); Assert.AreEqual(continuingStatus, block4.MultiBlockQuote); }
public void CleanUpOrphanedMultiBlockQuoteStati_NoneFollowedByNonStart_NonStartChangedToNone(MultiBlockQuote continuingStatus) { var block1 = CreateTestBlock(1, MultiBlockQuote.None); var block2 = CreateTestBlock(2, continuingStatus); var block1Original = block1.Clone(); var block2Original = block2.Clone(); var book = new BookScript { Blocks = new List <Block> { block1, block2 } }; var books = new List <BookScript> { book }; ProjectDataMigrator.CleanUpOrphanedMultiBlockQuoteStati(books); Assert.AreEqual(2, book.Blocks.Count); Assert.AreEqual(block1Original.GetText(true), block1.GetText(true)); Assert.AreEqual(block2Original.GetText(true), block2.GetText(true)); Assert.AreEqual(MultiBlockQuote.None, block1.MultiBlockQuote); Assert.AreEqual(MultiBlockQuote.None, block2.MultiBlockQuote); }
public void CleanUpOrphanedMultiBlockQuoteStati_TwoStartsFollowedByNone_BothStartsChangedToNone() { var block1 = CreateTestBlock(1, MultiBlockQuote.None); var block2 = CreateTestBlock(2, MultiBlockQuote.Start); var block3 = CreateTestBlock(3, MultiBlockQuote.Start); var block4 = CreateTestBlock(4, MultiBlockQuote.None); var block1Original = block1.Clone(); var block2Original = block2.Clone(); var block3Original = block3.Clone(); var block4Original = block4.Clone(); var book = new BookScript { Blocks = new List <Block> { block1, block2, block3, block4 } }; var books = new List <BookScript> { book }; ProjectDataMigrator.CleanUpOrphanedMultiBlockQuoteStati(books); Assert.AreEqual(4, book.Blocks.Count); Assert.AreEqual(block1Original.GetText(true), block1.GetText(true)); Assert.AreEqual(block2Original.GetText(true), block2.GetText(true)); Assert.AreEqual(block3Original.GetText(true), block3.GetText(true)); Assert.AreEqual(block4Original.GetText(true), block4.GetText(true)); Assert.AreEqual(MultiBlockQuote.None, block1.MultiBlockQuote); Assert.AreEqual(MultiBlockQuote.None, block2.MultiBlockQuote); Assert.AreEqual(MultiBlockQuote.None, block3.MultiBlockQuote); Assert.AreEqual(MultiBlockQuote.None, block4.MultiBlockQuote); }
public void SetBookIdForChapterBlocks_Normal_AllChapterBlocksGetBookIdSet(string chapterStyleTag) { var genesis = new BookScript("GEN", new List <Block> { CreateTestBlock(CharacterVerseData.GetStandardCharacterId("GEN", CharacterVerseData.StandardCharacter.BookOrChapter)), CreateChapterBlock("GEN", 1, chapterStyleTag), CreateTestBlock(1, MultiBlockQuote.None), CreateChapterBlock("GEN", 2, chapterStyleTag), CreateTestBlock(1, MultiBlockQuote.None), CreateTestBlock(2, MultiBlockQuote.None), CreateChapterBlock("GEN", 3, chapterStyleTag), CreateTestBlock(1, MultiBlockQuote.None), CreateChapterBlock("GEN", 4, chapterStyleTag), CreateTestBlock(1, MultiBlockQuote.None), CreateTestBlock(2, MultiBlockQuote.None), CreateTestBlock(3, MultiBlockQuote.None), CreateTestBlock(4, MultiBlockQuote.None), CreateChapterBlock("GEN", 5, chapterStyleTag), CreateTestBlock(1, MultiBlockQuote.None), } ); var matthew = new BookScript("MAT", new List <Block> { CreateTestBlock(CharacterVerseData.GetStandardCharacterId("MAT", CharacterVerseData.StandardCharacter.BookOrChapter)), CreateChapterBlock("MAT", 1, chapterStyleTag), CreateTestBlock(2, MultiBlockQuote.None), CreateTestBlock(1, MultiBlockQuote.None), CreateChapterBlock("MAT", 2, chapterStyleTag), CreateTestBlock(1, MultiBlockQuote.None), CreateTestBlock(2, MultiBlockQuote.None), CreateTestBlock(3, MultiBlockQuote.None), CreateTestBlock(4, MultiBlockQuote.None), CreateChapterBlock("MAT", 3, chapterStyleTag), CreateTestBlock(1, MultiBlockQuote.None), CreateChapterBlock("MAT", 4, chapterStyleTag), CreateTestBlock(1, MultiBlockQuote.None), CreateChapterBlock("MAT", 5, chapterStyleTag), CreateTestBlock(1, MultiBlockQuote.None), CreateTestBlock(2, MultiBlockQuote.None), CreateChapterBlock("MAT", 6, chapterStyleTag), CreateTestBlock(1, MultiBlockQuote.None), CreateTestBlock(2, MultiBlockQuote.None), CreateChapterBlock("MAT", 20, chapterStyleTag), CreateTestBlock(1, MultiBlockQuote.None), CreateTestBlock(2, MultiBlockQuote.None), CreateTestBlock(3, MultiBlockQuote.None), } ); var books = new List <BookScript> { genesis, matthew }; ProjectDataMigrator.SetBookIdForChapterBlocks(books); Assert.IsFalse(books.SelectMany(book => book.Blocks).Where(bl => bl.StyleTag == "c" || bl.StyleTag == "cl").Any(bl => bl.BookCode == null)); }
public void MigrateInvalidMultiBlockQuoteDataToVersion88_SplitDoesntStartWithMultiBlockStart_DataUnchanged() { var block1 = new Block { BlockElements = new List <BlockElement> { new Verse("1"), new ScriptText("Text of verse 1. "), }, MultiBlockQuote = MultiBlockQuote.None, SplitId = 0, }; var block2 = new Block { BlockElements = new List <BlockElement> { new Verse("2"), new ScriptText("Text of verse 2. "), }, MultiBlockQuote = MultiBlockQuote.Start, SplitId = 0, }; var block3 = new Block { BlockElements = new List <BlockElement> { new Verse("3"), new ScriptText("Text of verse 3. "), }, MultiBlockQuote = MultiBlockQuote.Continuation, SplitId = 0, }; var block1Original = block1.Clone(); var block2Original = block2.Clone(); var block3Original = block3.Clone(); var book = new BookScript { Blocks = new List <Block> { block1, block2, block3 } }; var books = new List <BookScript> { book }; ProjectDataMigrator.MigrateInvalidMultiBlockQuoteData(books); Assert.AreEqual(3, book.Blocks.Count); Assert.AreEqual(block1Original.GetText(true), block1.GetText(true)); Assert.AreEqual(block2Original.GetText(true), block2.GetText(true)); Assert.AreEqual(block3Original.GetText(true), block3.GetText(true)); Assert.AreEqual(MultiBlockQuote.None, block1.MultiBlockQuote); Assert.AreEqual(MultiBlockQuote.Start, block2.MultiBlockQuote); Assert.AreEqual(MultiBlockQuote.Continuation, block3.MultiBlockQuote); }
public void MigrateInvalidMultiBlockQuoteDataToVersion88_SplitWithMultiBlockStartAndNone_ChangedToNoneAndStart(MultiBlockQuote lastBlockMultiBlockQuote) { var block1 = new Block { BlockElements = new List <BlockElement> { new Verse("1"), new ScriptText("Text of verse 1. "), }, MultiBlockQuote = MultiBlockQuote.Start, SplitId = 0, }; var block2 = new Block { BlockElements = new List <BlockElement> { new Verse("2"), new ScriptText("Text of verse 2. "), }, MultiBlockQuote = MultiBlockQuote.None, SplitId = 0, }; var block3 = new Block { BlockElements = new List <BlockElement> { new Verse("3"), new ScriptText("Text of verse 3. "), }, MultiBlockQuote = lastBlockMultiBlockQuote }; var block1Original = block1.Clone(); var block2Original = block2.Clone(); var block3Original = block3.Clone(); var book = new BookScript("MAT", new List <Block> { block1, block2, block3 }); var books = new List <BookScript> { book }; ProjectDataMigrator.MigrateInvalidMultiBlockQuoteData(books); Assert.AreEqual(3, book.Blocks.Count); Assert.AreEqual(block1Original.GetText(true), block1.GetText(true)); Assert.AreEqual(block2Original.GetText(true), block2.GetText(true)); Assert.AreEqual(block3Original.GetText(true), block3.GetText(true)); Assert.AreEqual(MultiBlockQuote.None, block1.MultiBlockQuote); Assert.AreEqual(MultiBlockQuote.Start, block2.MultiBlockQuote); Assert.AreEqual(lastBlockMultiBlockQuote, block3.MultiBlockQuote); }
public void MigrateDeprecatedCharacterIds_DeliveryChangedForOneOfTwoCharactersInVerse_DeliveryChangedInBlock(string character, string initialDelivery, string expectedDelivery) { var testProject = TestProject.CreateTestProject(TestProject.TestBook.LUK); TestProject.SimulateDisambiguationForAllBooks(testProject); var block = testProject.IncludedBooks.Single().GetBlocksForVerse(18, 39).Last(); block.CharacterId = character; block.Delivery = initialDelivery; Assert.AreEqual(1, ProjectDataMigrator.MigrateDeprecatedCharacterIds(testProject)); Assert.AreEqual(expectedDelivery, block.Delivery); }
public void MigrateDeprecatedCharacterIds_ExistingAmbiguousUserNotConfirmed_NoChanges() { var testProject = TestProject.CreateTestProject(TestProject.TestBook.LUK); TestProject.SimulateDisambiguationForAllBooks(testProject); var block = testProject.IncludedBooks.Single().GetBlocksForVerse(18, 39).Last(); block.CharacterId = CharacterVerseData.kAmbiguousCharacter; block.UserConfirmed = false; Assert.AreEqual(0, ProjectDataMigrator.MigrateDeprecatedCharacterIds(testProject)); Assert.AreEqual(false, block.UserConfirmed); }
public void MigrateDeprecatedCharacterIds_CharacterIdReplacedWithSingleId_CharacterIdInScriptSetToReplacementId() { var testProject = TestProject.CreateTestProject(TestProject.TestBook.REV); TestProject.SimulateDisambiguationForAllBooks(testProject); var angelsSpeakingInRev712 = testProject.IncludedBooks.Single().GetBlocksForVerse(7, 12).ElementAt(1); angelsSpeakingInRev712.SetCharacterIdAndCharacterIdInScript("tons of angelic beings", 66); Assert.AreEqual(1, ProjectDataMigrator.MigrateDeprecatedCharacterIds(testProject)); Assert.AreEqual("angels, all the", angelsSpeakingInRev712.CharacterId); Assert.AreEqual("angels, all the", angelsSpeakingInRev712.CharacterIdInScript); }
public void MigrateDeprecatedCharacterIds_ExistingAmbiguousUserConfirmed_ClearsUserConfirmed() { // Note: this scenario was caused by a bug in a previous version of this method. var testProject = TestProject.CreateTestProject(TestProject.TestBook.LUK); TestProject.SimulateDisambiguationForAllBooks(testProject); var block = testProject.IncludedBooks.Single().GetBlocksForVerse(18, 39).Last(); block.CharacterId = CharacterVerseData.kAmbiguousCharacter; block.UserConfirmed = true; Assert.AreEqual(1, ProjectDataMigrator.MigrateDeprecatedCharacterIds(testProject)); Assert.AreEqual(false, block.UserConfirmed); }
public void MigrateDeprecatedCharacterIds_StandardCharacterIdUsedInUnexpectedPlaceIsLaterRenamed_CharacterIdInScriptSetToUnknown() { var testProject = TestProject.CreateTestProject(TestProject.TestBook.REV); TestProject.SimulateDisambiguationForAllBooks(testProject); var unexpectedPeterInRev711 = testProject.IncludedBooks.Single().GetBlocksForVerse(7, 11).First(); testProject.ProjectCharacterVerseData.Add(new CharacterVerse(new BCVRef(66, 7, 11), "peter", "", "", true)); unexpectedPeterInRev711.SetCharacterIdAndCharacterIdInScript("peter", 66); Assert.AreEqual(1, ProjectDataMigrator.MigrateDeprecatedCharacterIds(testProject)); Assert.AreEqual(CharacterVerseData.kUnknownCharacter, unexpectedPeterInRev711.CharacterId); Assert.IsFalse(testProject.ProjectCharacterVerseData.Any()); }
public void MigrateDeprecatedCharacterIds_CharacterIdRemoved_MultipleCharactersStillInVerse_CharacterIdInScriptSetToAmbiguous() { var testProject = TestProject.CreateTestProject(TestProject.TestBook.REV); TestProject.SimulateDisambiguationForAllBooks(testProject); var blockInRev13V10 = testProject.IncludedBooks.Single().GetBlocksForVerse(13, 10).First(); blockInRev13V10.SetCharacterIdAndCharacterIdInScript("angels, all the", 66); blockInRev13V10.CharacterIdOverrideForScript = "angels, all, the"; Assert.AreEqual("angels, all, the", blockInRev13V10.CharacterIdInScript); Assert.AreEqual(1, ProjectDataMigrator.MigrateDeprecatedCharacterIds(testProject)); Assert.AreEqual(CharacterVerseData.kAmbiguousCharacter, blockInRev13V10.CharacterId); Assert.AreEqual(CharacterVerseData.kAmbiguousCharacter, blockInRev13V10.CharacterIdInScript); }
public void MigrateDeprecatedCharacterIds_CharacterIdRemoved_NoOtherCharactersInVerse_CharacterIdInScriptSetToUnknown() { var testProject = TestProject.CreateTestProject(TestProject.TestBook.REV); TestProject.SimulateDisambiguationForAllBooks(testProject); var blockInRev43 = testProject.IncludedBooks.Single().GetBlocksForVerse(4, 3).First(); blockInRev43.SetCharacterIdAndCharacterIdInScript("angels, all the", 66); blockInRev43.CharacterIdOverrideForScript = "angels, all, the"; Assert.AreEqual("angels, all, the", blockInRev43.CharacterIdInScript); Assert.AreEqual(1, ProjectDataMigrator.MigrateDeprecatedCharacterIds(testProject)); Assert.AreEqual(CharacterVerseData.kUnknownCharacter, blockInRev43.CharacterId); Assert.AreEqual(CharacterVerseData.kUnknownCharacter, blockInRev43.CharacterIdInScript); }
public void MigrateDeprecatedCharacterIds_OneMemberOfMultiCharacterIdChanged_CharacterIdInScriptSetToReplacementId() { var testProject = TestProject.CreateTestProject(TestProject.TestBook.REV); TestProject.SimulateDisambiguationForAllBooks(testProject); var singersInRev59 = testProject.IncludedBooks.Single().GetBlocksForVerse(5, 9).Skip(1).ToList(); foreach (var block in singersInRev59) { block.SetCharacterIdAndCharacterIdInScript("cuatro living creatures/twenty-four elders", 66); } Assert.AreEqual(singersInRev59.Count, ProjectDataMigrator.MigrateDeprecatedCharacterIds(testProject)); Assert.True(singersInRev59.All(b => b.CharacterId == "living creature, first/living creature, second/living creature, third/living creature, fourth/twenty-four elders" && b.CharacterIdInScript == "living creature, first")); }
public void MigrateDeprecatedCharacterIds_DeliveryChanged_DeliveryChangedInBlock(string initialDelivery) { var testProject = TestProject.CreateTestProject(TestProject.TestBook.REV); TestProject.SimulateDisambiguationForAllBooks(testProject); var singersInRev59 = testProject.IncludedBooks.Single().GetBlocksForVerse(5, 9).Skip(1).ToList(); foreach (var block in singersInRev59) { block.Delivery = initialDelivery; } Assert.AreEqual(singersInRev59.Count, ProjectDataMigrator.MigrateDeprecatedCharacterIds(testProject)); Assert.True(singersInRev59.All(b => b.CharacterId == "living creature, first/living creature, second/living creature, third/living creature, fourth/twenty-four elders" && b.Delivery == "singing")); }
public void MigrateInvalidCharacterIdForScriptDataToVersion88_ValidData_Unchanged() { var block1 = CreateTestBlock("Andrew"); var block2 = CreateTestBlock("Peter"); var book = new BookScript("MAT", new List <Block> { block1, block2 }); var books = new List <BookScript> { book }; ProjectDataMigrator.MigrateInvalidCharacterIdForScriptData(books); Assert.AreEqual("Andrew", block1.CharacterId); Assert.AreEqual("Andrew", block1.CharacterIdInScript); Assert.AreEqual("Peter", block2.CharacterId); Assert.AreEqual("Peter", block2.CharacterIdInScript); }
public void MigrateInvalidMultiBlockQuoteDataToVersion88_NoSplits_DataUnchanged(MultiBlockQuote lastBlockMultiBlockQuote) { var block1 = new Block { BlockElements = new List <BlockElement> { new Verse("1"), new ScriptText("Text of verse 1. "), }, MultiBlockQuote = MultiBlockQuote.Start, }; var block2 = new Block { BlockElements = new List <BlockElement> { new Verse("2"), new ScriptText("Text of verse 2. "), }, MultiBlockQuote = lastBlockMultiBlockQuote, }; var block1Original = block1.Clone(); var block2Original = block2.Clone(); var book = new BookScript { Blocks = new List <Block> { block1, block2 } }; var books = new List <BookScript> { book }; ProjectDataMigrator.MigrateInvalidMultiBlockQuoteData(books); Assert.AreEqual(2, book.Blocks.Count); Assert.AreEqual(block1Original.GetText(true), block1.GetText(true)); Assert.AreEqual(block2Original.GetText(true), block2.GetText(true)); Assert.AreEqual(MultiBlockQuote.Start, block1.MultiBlockQuote); Assert.AreEqual(lastBlockMultiBlockQuote, block2.MultiBlockQuote); }
public void MigrateDeprecatedCharacterIds_OneOfTwoCharacterIdsInVerseReplacedWithDifferentId_CharacterIdInScriptSetToAmbiguous() { var testProject = TestProject.CreateTestProject(TestProject.TestBook.REV); TestProject.SimulateDisambiguationForAllBooks(testProject); var johnSpeakingInRev714 = testProject.IncludedBooks.Single().GetBlocksForVerse(7, 14).ElementAt(1); johnSpeakingInRev714.SetCharacterIdAndCharacterIdInScript("John", 66); johnSpeakingInRev714.UserConfirmed = true; var elderSpeakingInRev714 = testProject.IncludedBooks.Single().GetBlocksForVerse(7, 14).ElementAt(3); elderSpeakingInRev714.SetCharacterIdAndCharacterIdInScript("elders, one of the", 66); Assert.True(johnSpeakingInRev714.UserConfirmed); Assert.AreEqual(1, ProjectDataMigrator.MigrateDeprecatedCharacterIds(testProject)); Assert.AreEqual(CharacterVerseData.kAmbiguousCharacter, johnSpeakingInRev714.CharacterId); Assert.AreEqual(CharacterVerseData.kAmbiguousCharacter, johnSpeakingInRev714.CharacterIdInScript); Assert.False(johnSpeakingInRev714.UserConfirmed); Assert.AreEqual("elders, one of the", elderSpeakingInRev714.CharacterId); Assert.AreEqual("elders, one of the", elderSpeakingInRev714.CharacterIdInScript); }
public void CleanUpOrphanedMultiBlockQuoteStati_LastBlockIsStart_StartChangedToNone() { var block1 = CreateTestBlock(1, MultiBlockQuote.None); var block2 = CreateTestBlock(2, MultiBlockQuote.Start); var block1Original = block1.Clone(); var block2Original = block2.Clone(); var book = new BookScript("MAT", new List <Block> { block1, block2 }); var books = new List <BookScript> { book }; ProjectDataMigrator.CleanUpOrphanedMultiBlockQuoteStati(books); Assert.AreEqual(2, book.Blocks.Count); Assert.AreEqual(block1Original.GetText(true), block1.GetText(true)); Assert.AreEqual(block2Original.GetText(true), block2.GetText(true)); Assert.AreEqual(MultiBlockQuote.None, block1.MultiBlockQuote); Assert.AreEqual(MultiBlockQuote.None, block2.MultiBlockQuote); }
public void MigrateInvalidCharacterIdsWithoutCharacterIdInScriptOverrides_ControlFileHasNoExplicitDefault_FirstCharacterIsUsed() { var testProject = TestProject.CreateTestProject(TestProject.TestBook.MRK); TestProject.SimulateDisambiguationForAllBooks(testProject); var jesusSpeakingInMrk59 = testProject.IncludedBooks.Single().GetBlocksForVerse(5, 9).ElementAt(1); jesusSpeakingInMrk59.SetCharacterIdAndCharacterIdInScript("Jesus", 66); jesusSpeakingInMrk59.UserConfirmed = true; var demonSpeakingInMrk59 = testProject.IncludedBooks.Single().GetBlocksForVerse(5, 9).ElementAt(3); demonSpeakingInMrk59.CharacterId = "demons (Legion)/man delivered from Legion of demons"; demonSpeakingInMrk59.CharacterIdOverrideForScript = null; demonSpeakingInMrk59.UserConfirmed = true; Assert.AreEqual(1, ProjectDataMigrator.MigrateInvalidCharacterIdsWithoutCharacterIdInScriptOverrides(testProject)); Assert.AreEqual("Jesus", jesusSpeakingInMrk59.CharacterId); Assert.AreEqual("Jesus", jesusSpeakingInMrk59.CharacterIdInScript); Assert.IsTrue(jesusSpeakingInMrk59.UserConfirmed); Assert.AreEqual("demons (Legion)/man delivered from Legion of demons", demonSpeakingInMrk59.CharacterId); Assert.AreEqual("demons (Legion)", demonSpeakingInMrk59.CharacterIdInScript); Assert.IsTrue(demonSpeakingInMrk59.UserConfirmed); }
public void MigrateInvalidMultiBlockQuoteDataToVersion88_SplitWithMultiBlockStartChangeNoneChange_ChangedToStartChangeStartChange() { var block1 = new Block { BlockElements = new List <BlockElement> { new Verse("1"), new ScriptText("Text of verse 1. "), }, MultiBlockQuote = MultiBlockQuote.Start, }; var block2 = new Block { BlockElements = new List <BlockElement> { new Verse("2"), new ScriptText("Text of verse 2. "), }, MultiBlockQuote = MultiBlockQuote.ChangeOfDelivery, SplitId = 0, }; var block3 = new Block { BlockElements = new List <BlockElement> { new Verse("3"), new ScriptText("Text of verse 3. "), }, MultiBlockQuote = MultiBlockQuote.None, SplitId = 0, }; var block4 = new Block { BlockElements = new List <BlockElement> { new Verse("4"), new ScriptText("Text of verse 4. "), }, MultiBlockQuote = MultiBlockQuote.ChangeOfDelivery }; var block5 = new Block { BlockElements = new List <BlockElement> { new Verse("5"), new ScriptText("Text of verse 5. "), }, MultiBlockQuote = MultiBlockQuote.Continuation }; var block1Original = block1.Clone(); var block2Original = block2.Clone(); var block3Original = block3.Clone(); var block4Original = block4.Clone(); var block5Original = block5.Clone(); var book = new BookScript("MAT", new List <Block> { block1, block2, block3, block4, block5 }); var books = new List <BookScript> { book }; ProjectDataMigrator.MigrateInvalidMultiBlockQuoteData(books); Assert.AreEqual(5, book.Blocks.Count); Assert.AreEqual(block1Original.GetText(true), block1.GetText(true)); Assert.AreEqual(block2Original.GetText(true), block2.GetText(true)); Assert.AreEqual(block3Original.GetText(true), block3.GetText(true)); Assert.AreEqual(block4Original.GetText(true), block4.GetText(true)); Assert.AreEqual(block5Original.GetText(true), block5.GetText(true)); Assert.AreEqual(MultiBlockQuote.Start, block1.MultiBlockQuote); Assert.AreEqual(MultiBlockQuote.ChangeOfDelivery, block2.MultiBlockQuote); Assert.AreEqual(MultiBlockQuote.Start, block3.MultiBlockQuote); Assert.AreEqual(MultiBlockQuote.ChangeOfDelivery, block4.MultiBlockQuote); Assert.AreEqual(MultiBlockQuote.Continuation, block5.MultiBlockQuote); }