public void ValidateReferencesWithDB() { m_mlscrBook = new DBMultilingScrBooks(m_scr); m_mlscrBook.InitializeWritingSystems( m_fdoCache.LanguageWritingSystemFactoryAccessor); Assert.IsFalse(m_mlscrBook.IsBookAvailableInDb(1), "Genesis found"); Assert.IsTrue("genesis" != m_mlscrBook.GetBookName(1).ToLower(), "Genesis found"); Assert.IsFalse(m_mlscrBook.IsReferenceValid("GEN 1:4"), "GEN 1:4 said to be a valid Reference"); Assert.IsTrue(m_mlscrBook.IsBookAvailableInDb(59), "James not found"); Assert.AreEqual("James".ToLower(), m_mlscrBook.GetBookName(59).ToLower(), "James found"); Assert.IsTrue(m_mlscrBook.IsReferenceValid("JAS 1:12"), "JAS 1:12 said to be an invalid Reference"); // These were removed because setting a reference to out of range values will // cause the values to be set to 1 and then the reference is valid. // Assert.IsFalse(mlscrBook.IsReferenceValid("JAS 50:1"), // "JAS 50:1 is valid Reference... go figure"); // Assert.IsFalse(mlscrBook.IsReferenceValid("JAS 1:50"), // "JAS 1:50 is valid Reference... go figure"); }
public void CreateScrBookRefs() { CheckDisposed(); IScrRefSystem scr = Cache.ScriptureReferenceSystem; m_scrInitializer.CallCreateScrBookRefs(Cache); FdoOwningSequence <IScrBookRef> books = scr.BooksOS; // Make sure the right number of books was generated. Assert.AreEqual(66, books.Count); ILgWritingSystemFactory wsf = Cache.LanguageWritingSystemFactoryAccessor; int wsEnglish = wsf.GetWsFromStr("en"); int wsSpanish = wsf.GetWsFromStr("es"); // Check English Genesis IScrBookRef genesis = books[0]; Assert.AreEqual("Genesis", genesis.BookName.GetAlternative(wsEnglish)); Assert.AreEqual("Gen", genesis.BookAbbrev.GetAlternative(wsEnglish)); Assert.IsNull(genesis.BookNameAlt.GetAlternative(wsEnglish)); // Check Spanish Matthew IScrBookRef mateo = books[39]; Assert.AreEqual("Mateo", mateo.BookName.GetAlternative(wsSpanish)); Assert.AreEqual("Mt", mateo.BookAbbrev.GetAlternative(wsSpanish)); Assert.IsNull(mateo.BookNameAlt.GetAlternative(wsSpanish)); // Check English 2 Corinthians IScrBookRef iiCor = books[46]; Assert.AreEqual("2 Corinthians", iiCor.BookName.GetAlternative(wsEnglish)); Assert.AreEqual("2Cor", iiCor.BookAbbrev.GetAlternative(wsEnglish)); Assert.AreEqual("II Corinthians", iiCor.BookNameAlt.GetAlternative(wsEnglish)); // Check Spanish Revelation IScrBookRef apocalipsis = books[65]; Assert.AreEqual("Apocalipsis", apocalipsis.BookName.GetAlternative(wsSpanish)); Assert.AreEqual("Ap", apocalipsis.BookAbbrev.GetAlternative(wsSpanish)); Assert.IsNull(apocalipsis.BookNameAlt.GetAlternative(wsSpanish)); MultilingScrBooks mlsb = new MultilingScrBooks(m_scr); mlsb.InitializeWritingSystems(Cache.LanguageWritingSystemFactoryAccessor); foreach (IScrBookRef brf in books) { string sBookName = brf.BookName.GetAlternative(wsEnglish); Assert.IsTrue(sBookName != null && sBookName != string.Empty); string sBookAbbrev = brf.BookAbbrev.GetAlternative(wsEnglish); Assert.IsTrue(sBookAbbrev != null && sBookAbbrev != string.Empty); } }
public void Setup() { m_mlscrBook = new MultilingScrBooks(m_scr); m_mlscrBook.InitializeWritingSystems( m_fdoCache.LanguageWritingSystemFactoryAccessor); }