[TestCase("PSA", 33, 23, ExpectedResult = "David")] // Should map to PSA 34:23 (Original) -> PSA 34:22 (English) public string GetCharacterOverrideDetailsForRefRange_VulgateVersificationChapterOutsideOfOverrideRangeBeforeMappingToEnglish_MapsToReturnCorrectOverrideCharacter(string bookId, int chapter, int verse) { var bookNum = BCVRef.BookToNumber(bookId); var verseRef = new VerseRef(new BCVRef(bookNum, chapter, verse), ScrVers.Vulgate); return(NarratorOverrides.GetCharacterOverrideDetailsForRefRange(verseRef, verse).Single().Character); }
public void GetCharacterOverrideDetailsForRefRange_ChapterAfterAnyOverrideInBook_ReturnsEmpty() { var bookNum = BCVRef.BookToNumber("EZR"); var ezra10_1 = new VerseRef(new BCVRef(bookNum, 10, 1), ScrVers.English); Assert.IsFalse(NarratorOverrides.GetCharacterOverrideDetailsForRefRange(ezra10_1, 1).Any()); }
public void GetCharacterOverrideDetailsForRefRange_VerseBeforeFirstVerseInOverriddenChapter_ReturnsEmpty() { var bookNum = BCVRef.BookToNumber("EZR"); var ezra7_26 = new VerseRef(new BCVRef(bookNum, 7, 26), ScrVers.English); Assert.IsFalse(NarratorOverrides.GetCharacterOverrideDetailsForRefRange(ezra7_26, 26).Any()); }
public void GetCharacterOverrideDetailsForRefRange_VerseAfterLastVerseInOverriddenChapter_ReturnsEmpty() { var bookNum = BCVRef.BookToNumber("NEH"); var nehemiah7_6 = new VerseRef(new BCVRef(bookNum, 7, 6), ScrVers.English); Assert.IsFalse(NarratorOverrides.GetCharacterOverrideDetailsForRefRange(nehemiah7_6, 6).Any()); }
public void GetCharacterOverrideDetailsForRefRange_RangeOnlyPartiallyWithinOverride_ReturnsEmpty(string bookId, int chapter, int startVerse, int endVerse) { var bookNum = BCVRef.BookToNumber(bookId); var verseRef = new VerseRef(new BCVRef(bookNum, chapter, startVerse), ScrVers.English); Assert.IsFalse(NarratorOverrides.GetCharacterOverrideDetailsForRefRange(verseRef, endVerse).Any()); }
public void GetCharacterOverrideDetailsForRefRange_RangeStartsInVerseZeroInMultiChapterOverride_ReturnsEmpty() { var bookNum = BCVRef.BookToNumber("PSA"); var verseRef = new VerseRef(new BCVRef(bookNum, 45, 0), ScrVers.English); Assert.IsFalse(NarratorOverrides.GetCharacterOverrideDetailsForRefRange(verseRef, 2).Any()); }
public void GetCharacterOverrideDetailsForRefRange_LastVerseInOverride_ReturnsCorrectOverrideCharacter() { var bookNum = BCVRef.BookToNumber("NEH"); var nehemiah7_5 = new VerseRef(new BCVRef(bookNum, 7, 5), ScrVers.English); Assert.AreEqual("Nehemiah", NarratorOverrides.GetCharacterOverrideDetailsForRefRange(nehemiah7_5, 5).Single().Character); }
public void GetCharacterOverrideDetailsForRefRange_FirstVerseInOverride_ReturnsCorrectOverrideCharacter() { var bookNum = BCVRef.BookToNumber("EZR"); var ezra7_27 = new VerseRef(new BCVRef(bookNum, 7, 27), ScrVers.English); Assert.AreEqual("Ezra, priest and teacher", NarratorOverrides.GetCharacterOverrideDetailsForRefRange(ezra7_27, 27).Single().Character); }
public void GetCharacterOverrideDetailsForRefRange_EndVerseLessThanStartVerse_ThrowsArgumentOutOfRangeException() { var bookNum = BCVRef.BookToNumber("PSA"); var verseRef = new VerseRef(new BCVRef(bookNum, 45, 2), ScrVers.English); Assert.Throws <ArgumentOutOfRangeException>(() => NarratorOverrides.GetCharacterOverrideDetailsForRefRange(verseRef, 0)); Assert.Throws <ArgumentOutOfRangeException>(() => NarratorOverrides.GetCharacterOverrideDetailsForRefRange(verseRef, 1)); }
public void DataIntegrity_StartChapterSet() { foreach (var bookId in NarratorOverrides.NarratorOverridesByBookId.Keys) { foreach (var overrideDetail in NarratorOverrides.GetNarratorOverridesForBook(bookId)) { Assert.IsTrue(overrideDetail.StartChapter >= 1, $"In NarratorOverides.xml, book {bookId}, StartChapter not set for override {overrideDetail}."); } } }
public void DataIntegrity_StartBlockLessThanSix() { foreach (var bookId in NarratorOverrides.NarratorOverridesByBookId.Keys) { foreach (var overrideDetail in NarratorOverrides.GetNarratorOverridesForBook(bookId)) { Assert.IsTrue(overrideDetail.StartBlock < 6, $"In NarratorOverides.xml, book {bookId}, StartBlock set to invalid value for override {overrideDetail}."); } } }
public void DataIntegrity_NoOverridesCoverVersesWithImplicitCharacter() { foreach (var cv in ControlCharacterVerseData.Singleton.GetAllQuoteInfo().Where(i => i.IsImplicit)) { var verse = new VerseRef(BCVRef.BookToNumber(cv.BookCode), cv.Chapter, cv.Verse, ScrVers.English); var overrideInfo = NarratorOverrides.GetCharacterOverrideDetailsForRefRange(verse, cv.Verse); Assert.IsTrue(overrideInfo.All(oi => oi.Character != cv.Character), $"Character-verse file contains an Implicit quote for {cv.Character} in verse {verse} that is also covered " + $"by narrator override {overrideInfo}."); } }
public string GetCharacterOverrideDetailsForRefRange_VerseInMiddleChapterInMultiChapterOverride_ReturnsCorrectOverrideCharacter(string bookId, int chapter, int verse) { var bookNum = BCVRef.BookToNumber(bookId); if (verse == -1) { verse = ScrVers.English.GetLastVerse(bookNum, chapter); } var verseRef = new VerseRef(new BCVRef(bookNum, chapter, verse), ScrVers.English); return(NarratorOverrides.GetCharacterOverrideDetailsForRefRange(verseRef, verse).Single().Character); }
public string GetCharacterOverrideDetailsForRefRange_RangeWithinOverride_ReturnsCorrectOverrideCharacter(string bookId, int chapter, int startVerse, int endVerse) { var bookNum = BCVRef.BookToNumber(bookId); if (endVerse == -1) { endVerse = ScrVers.English.GetLastVerse(bookNum, chapter); } var startRef = new VerseRef(new BCVRef(bookNum, chapter, startVerse), ScrVers.English); return(NarratorOverrides.GetCharacterOverrideDetailsForRefRange(startRef, endVerse).Single().Character); }
[TestCase(-1)] // PSA 32:22 in Vulgate maps to PSA 33:22 in English public void GetCharacterOverrideDetailsForRefRange_VulgateVersificationChapterInsideOfOverrideRangeBeforeMappingToEnglish_MapsToReturnCorrectOverrideCharacter(int verse) { const int kChapter = 32; var bookNum = BCVRef.BookToNumber("PSA"); if (verse == -1) { verse = ScrVers.Vulgate.GetLastVerse(bookNum, kChapter); } var verseRef = new VerseRef(new BCVRef(bookNum, kChapter, verse), ScrVers.Vulgate); Assert.AreEqual("psalmist", NarratorOverrides.GetCharacterOverrideDetailsForRefRange(verseRef, verse).Single().Character); }
public void DataIntegrity_NoOverlappingRanges() { var overridesByBook = new Dictionary <string, SortedDictionary <int, NarratorOverrides.NarratorOverrideDetail> >(); foreach (var bookId in NarratorOverrides.NarratorOverridesByBookId.Keys) { var bookNum = BCVRef.BookToNumber(bookId); var dictionary = new SortedDictionary <int, NarratorOverrides.NarratorOverrideDetail>(); overridesByBook.Add(bookId, dictionary); foreach (var overrideDetail in NarratorOverrides.GetNarratorOverridesForBook(bookId)) { var newKey = new BCVRef(bookNum, overrideDetail.StartChapter, overrideDetail.StartVerse).BBCCCVVV * 10 + overrideDetail.StartBlock; if (dictionary.ContainsKey(newKey)) { Assert.Fail($"In NarratorOverides.xml, book {bookId}: two overrides start at the same place:\n{dictionary[newKey]}\nAND\n{overrideDetail}"); } dictionary.Add(newKey, overrideDetail); } } foreach (var kvp in overridesByBook) { var dictionary = kvp.Value; NarratorOverrides.NarratorOverrideDetail prev = null; foreach (var overrideDetail in dictionary.Values) { if (prev != null) { Assert.True(overrideDetail.EndChapter > prev.EndChapter || (overrideDetail.EndChapter == prev.EndChapter && overrideDetail.EndVerse > prev.EndVerse) || (overrideDetail.EndChapter == prev.EndChapter && overrideDetail.EndVerse == prev.EndVerse && overrideDetail.EndBlock > prev.EndBlock), $"In NarratorOverides.xml, book {kvp.Key}: override {overrideDetail} overlaps {prev}."); } prev = overrideDetail; } } }
public void DataIntegrity_StartsPrecedeEnds() { foreach (var bookId in NarratorOverrides.NarratorOverridesByBookId.Keys) { foreach (var overrideDetail in NarratorOverrides.GetNarratorOverridesForBook(bookId)) { Assert.True(overrideDetail.StartChapter <= overrideDetail.EndChapter, $"In NarratorOverides.xml, book {bookId}: end chapter {overrideDetail.EndChapter} precedes start chapter {overrideDetail.StartChapter}."); if (overrideDetail.StartChapter == overrideDetail.EndChapter) { Assert.True(overrideDetail.StartVerse <= overrideDetail.EndVerse, $"In NarratorOverides.xml, book {bookId}, chapter {overrideDetail.StartChapter}: end verse {overrideDetail.EndVerse} precedes start verse {overrideDetail.StartVerse}."); if (overrideDetail.StartVerse == overrideDetail.EndVerse) { Assert.True(overrideDetail.StartBlock <= overrideDetail.EndBlock, $"In NarratorOverides.xml, an entry for {bookId} {overrideDetail.StartChapter}:{overrideDetail.EndVerse} " + $"has an end block {overrideDetail.EndBlock} that precedes its start block {overrideDetail.StartBlock}."); } } } } }
public void GetCharacterOverrideDetailsForRefRange_BookWithNoOverrides_ReturnsEmpty() { var genesis1_1 = new VerseRef(001001001, ScrVers.English); Assert.IsFalse(NarratorOverrides.GetCharacterOverrideDetailsForRefRange(genesis1_1, 1).Any()); }
public string GetCharacterOverrideDetailsForRefRange_MidVerseInSingleChapterOverride_ReturnsCorrectOverrideCharacter(string bookId, int chapter, int verse) { var verseRef = new VerseRef(new BCVRef(BCVRef.BookToNumber(bookId), chapter, verse), ScrVers.English); return(NarratorOverrides.GetCharacterOverrideDetailsForRefRange(verseRef, verse).Single().Character); }
public void DataIntegrity_LoadsCorrectly() { Assert.IsTrue(NarratorOverrides.GetNarratorOverridesForBook("PSA").Any()); }