public void DetermineOverwritability_DataLoss_MultipleHolesBefore() { DummyScrBook genesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis").Hvo); ScrSection section1cur = new ScrSection(); genesis.SectionsOS.Append(section1cur); section1cur.VerseRefStart = section1cur.VerseRefMin = new BCVRef(1, 1, 1).BBCCCVVV; section1cur.VerseRefEnd = section1cur.VerseRefMax = new BCVRef(1, 1, 15).BBCCCVVV; ScrSection section2cur = new ScrSection(); genesis.SectionsOS.Append(section2cur); section2cur.VerseRefStart = section2cur.VerseRefMin = new BCVRef(1, 1, 16).BBCCCVVV; section2cur.VerseRefEnd = section2cur.VerseRefMax = new BCVRef(1, 1, 19).BBCCCVVV; ScrSection section3cur = new ScrSection(); genesis.SectionsOS.Append(section3cur); section3cur.VerseRefStart = section3cur.VerseRefMin = new BCVRef(1, 1, 20).BBCCCVVV; section3cur.VerseRefEnd = section3cur.VerseRefMax = new BCVRef(1, 1, 31).BBCCCVVV; ScrSection section4cur = new ScrSection(); genesis.SectionsOS.Append(section4cur); section4cur.VerseRefStart = section4cur.VerseRefMin = new BCVRef(1, 2, 1).BBCCCVVV; section4cur.VerseRefEnd = section4cur.VerseRefMax = new BCVRef(1, 2, 13).BBCCCVVV; DummyScrBook savedGenesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddArchiveBookToMockedScripture(1, "Genesis").Hvo); ScrSection section1saved = new ScrSection(); savedGenesis.SectionsOS.Append(section1saved); section1saved.VerseRefStart = section1saved.VerseRefMin = new BCVRef(1, 1, 16).BBCCCVVV; section1saved.VerseRefEnd = section1saved.VerseRefMax = new BCVRef(1, 1, 19).BBCCCVVV; ScrSection section2saved = new ScrSection(); savedGenesis.SectionsOS.Append(section2saved); section2saved.VerseRefStart = section2saved.VerseRefMin = new BCVRef(1, 2, 1).BBCCCVVV; section2saved.VerseRefEnd = section2saved.VerseRefMax = new BCVRef(1, 2, 12).BBCCCVVV; string sDetails; List<IScrSection> sectionsToRemove; List<int> missingBtWs; Assert.AreEqual(OverwriteType.DataLoss, genesis.DetermineOverwritability(savedGenesis, out sDetails, out sectionsToRemove, out missingBtWs), "Cannot overwrite without data loss when a section in a saved book is missing the first verse"); Assert.IsNull(sectionsToRemove); Assert.AreEqual(" GEN 1:1-15" + Environment.NewLine + " GEN 1:20-31" + Environment.NewLine + " GEN 2:13", sDetails); }
public void DetermineOverwritability_DataLoss_NastyMismatchedHoles() { DummyScrBook genesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis").Hvo); ScrSection sectionCur = new ScrSection(); genesis.SectionsOS.Append(sectionCur); sectionCur.VerseRefStart = sectionCur.VerseRefMin = new BCVRef(1, 1, 1).BBCCCVVV; sectionCur.VerseRefEnd = sectionCur.VerseRefMax = new BCVRef(1, 1, 15).BBCCCVVV; sectionCur = new ScrSection(); genesis.SectionsOS.Append(sectionCur); sectionCur.VerseRefStart = sectionCur.VerseRefMin = new BCVRef(1, 1, 18).BBCCCVVV; sectionCur.VerseRefEnd = sectionCur.VerseRefMax = new BCVRef(1, 1, 29).BBCCCVVV; sectionCur = new ScrSection(); genesis.SectionsOS.Append(sectionCur); sectionCur.VerseRefStart = sectionCur.VerseRefMin = new BCVRef(1, 2, 1).BBCCCVVV; sectionCur.VerseRefEnd = sectionCur.VerseRefMax = new BCVRef(1, 2, 25).BBCCCVVV; sectionCur = new ScrSection(); genesis.SectionsOS.Append(sectionCur); sectionCur.VerseRefStart = sectionCur.VerseRefMin = new BCVRef(1, 3, 4).BBCCCVVV; sectionCur.VerseRefEnd = sectionCur.VerseRefMax = new BCVRef(1, 3, 15).BBCCCVVV; sectionCur = new ScrSection(); genesis.SectionsOS.Append(sectionCur); sectionCur.VerseRefStart = sectionCur.VerseRefMin = new BCVRef(1, 3, 18).BBCCCVVV; sectionCur.VerseRefEnd = sectionCur.VerseRefMax = new BCVRef(1, 3, 24).BBCCCVVV; sectionCur = new ScrSection(); genesis.SectionsOS.Append(sectionCur); sectionCur.VerseRefStart = sectionCur.VerseRefMin = new BCVRef(1, 4, 1).BBCCCVVV; sectionCur.VerseRefEnd = sectionCur.VerseRefMax = new BCVRef(1, 4, 4).BBCCCVVV; sectionCur = new ScrSection(); genesis.SectionsOS.Append(sectionCur); sectionCur.VerseRefStart = sectionCur.VerseRefMin = new BCVRef(1, 4, 10).BBCCCVVV; sectionCur.VerseRefEnd = sectionCur.VerseRefMax = new BCVRef(1, 4, 18).BBCCCVVV; DummyScrBook savedGenesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddArchiveBookToMockedScripture(1, "Genesis").Hvo); ScrSection sectionSaved = new ScrSection(); savedGenesis.SectionsOS.Append(sectionSaved); sectionSaved.VerseRefStart = sectionSaved.VerseRefMin = new BCVRef(1, 1, 1).BBCCCVVV; sectionSaved.VerseRefEnd = sectionSaved.VerseRefMax = new BCVRef(1, 1, 10).BBCCCVVV; sectionSaved = new ScrSection(); savedGenesis.SectionsOS.Append(sectionSaved); sectionSaved.VerseRefStart = sectionSaved.VerseRefMin = new BCVRef(1, 2, 22).BBCCCVVV; sectionSaved.VerseRefEnd = sectionSaved.VerseRefMax = new BCVRef(1, 2, 25).BBCCCVVV; sectionSaved = new ScrSection(); savedGenesis.SectionsOS.Append(sectionSaved); sectionSaved.VerseRefStart = sectionSaved.VerseRefMin = new BCVRef(1, 3, 4).BBCCCVVV; sectionSaved.VerseRefEnd = sectionSaved.VerseRefMax = new BCVRef(1, 3, 15).BBCCCVVV; sectionSaved = new ScrSection(); savedGenesis.SectionsOS.Append(sectionSaved); sectionSaved.VerseRefStart = sectionSaved.VerseRefMin = new BCVRef(1, 3, 18).BBCCCVVV; sectionSaved.VerseRefEnd = sectionSaved.VerseRefMax = new BCVRef(1, 3, 21).BBCCCVVV; sectionSaved = new ScrSection(); savedGenesis.SectionsOS.Append(sectionSaved); sectionSaved.VerseRefStart = sectionSaved.VerseRefMin = new BCVRef(1, 4, 1).BBCCCVVV; sectionSaved.VerseRefEnd = sectionSaved.VerseRefMax = new BCVRef(1, 4, 6).BBCCCVVV; sectionSaved = new ScrSection(); savedGenesis.SectionsOS.Append(sectionSaved); sectionSaved.VerseRefStart = sectionSaved.VerseRefMin = new BCVRef(1, 4, 8).BBCCCVVV; sectionSaved.VerseRefEnd = sectionSaved.VerseRefMax = new BCVRef(1, 4, 18).BBCCCVVV; string sDetails; List<IScrSection> sectionsToRemove; List<int> missingBtWs; Assert.AreEqual(OverwriteType.DataLoss, genesis.DetermineOverwritability(savedGenesis, out sDetails, out sectionsToRemove, out missingBtWs), "Cannot overwrite with saved book that contains a hole"); Assert.IsNull(sectionsToRemove); Assert.AreEqual(" GEN 1:11-15" + Environment.NewLine + " GEN 1:18-29" + Environment.NewLine + " GEN 2:1-21" + Environment.NewLine + " GEN 3:22-24", sDetails); }
public void DetermineOverwritability_DataLoss_SavedSubsetOfCurrent() { DummyScrBook genesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis").Hvo); ScrSection section1cur = new ScrSection(); genesis.SectionsOS.Append(section1cur); section1cur.VerseRefStart = section1cur.VerseRefMin = new BCVRef(1, 1, 1).BBCCCVVV; section1cur.VerseRefEnd = section1cur.VerseRefMax = new BCVRef(1, 1, 20).BBCCCVVV; DummyScrBook savedGenesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddArchiveBookToMockedScripture(1, "Genesis").Hvo); ScrSection section1saved = new ScrSection(); savedGenesis.SectionsOS.Append(section1saved); section1saved.VerseRefStart = section1saved.VerseRefMin = new BCVRef(1, 1, 5).BBCCCVVV; section1saved.VerseRefEnd = section1saved.VerseRefMax = new BCVRef(1, 1, 15).BBCCCVVV; string sDetails; List<IScrSection> sectionsToRemove; List<int> missingBtWs; Assert.AreEqual(OverwriteType.DataLoss, genesis.DetermineOverwritability(savedGenesis, out sDetails, out sectionsToRemove, out missingBtWs), "Cannot overwrite with saved book that starts after and ends before the current"); Assert.IsNull(sectionsToRemove); Assert.AreEqual(" GEN 1:1-4" + Environment.NewLine + " GEN 1:16-20", sDetails); }
public void DetermineOverwritability_DataLoss_OneVerseAddedToStart() { DummyScrBook genesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis").Hvo); ScrSection section1cur = new ScrSection(); genesis.SectionsOS.Append(section1cur); section1cur.VerseRefStart = section1cur.VerseRefMin = new BCVRef(1, 1, 1).BBCCCVVV; section1cur.VerseRefEnd = section1cur.VerseRefMax = new BCVRef(1, 1, 12).BBCCCVVV; DummyScrBook savedGenesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddArchiveBookToMockedScripture(1, "Genesis").Hvo); ScrSection section1saved = new ScrSection(); savedGenesis.SectionsOS.Append(section1saved); section1saved.VerseRefStart = section1saved.VerseRefMin = new BCVRef(1, 1, 2).BBCCCVVV; section1saved.VerseRefEnd = section1saved.VerseRefMax = new BCVRef(1, 1, 12).BBCCCVVV; string sDetails; List<IScrSection> sectionsToRemove; List<int> missingBtWs; Assert.AreEqual(OverwriteType.DataLoss, genesis.DetermineOverwritability(savedGenesis, out sDetails, out sectionsToRemove, out missingBtWs), "Cannot overwrite without data loss when a section in a saved book is missing the first verse"); Assert.IsNull(sectionsToRemove); Assert.AreEqual(" GEN 1:1", sDetails); }
public void DetermineOverwritability_FullNoDataLoss_CurrentHasNoScripture() { DummyScrBook genesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis").Hvo); ScrSection introCur = new ScrSection(); genesis.SectionsOS.Append(introCur); introCur.VerseRefStart = introCur.VerseRefMin = new BCVRef(1, 1, 0).BBCCCVVV; introCur.VerseRefEnd = introCur.VerseRefMax = new BCVRef(1, 1, 0).BBCCCVVV; DummyScrBook savedGenesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddArchiveBookToMockedScripture(1, "Genesis").Hvo); ScrSection section1saved = new ScrSection(); savedGenesis.SectionsOS.Append(section1saved); section1saved.VerseRefStart = section1saved.VerseRefMin = new BCVRef(1, 1, 0).BBCCCVVV; section1saved.VerseRefEnd = section1saved.VerseRefMax = new BCVRef(1, 1, 0).BBCCCVVV; ScrSection section2saved = new ScrSection(); savedGenesis.SectionsOS.Append(section2saved); section2saved.VerseRefStart = section2saved.VerseRefMin = new BCVRef(1, 1, 1).BBCCCVVV; section2saved.VerseRefEnd = section2saved.VerseRefMax = new BCVRef(1, 1, 15).BBCCCVVV; string sDetails; List<IScrSection> sectionsToRemove; List<int> missingBtWs; Assert.AreEqual(OverwriteType.FullNoDataLoss, genesis.DetermineOverwritability(savedGenesis, out sDetails, out sectionsToRemove, out missingBtWs), "Can overwrite current version of Scripture with saved book that only has an intro"); Assert.IsNull(sectionsToRemove); Assert.IsNull(sDetails); }
public void DetermineOverwritability_FullNoDataLoss_SectionContainsOutOfOrderVerses() { DummyScrBook genesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis").Hvo); ScrSection section1Cur = new ScrSection(); genesis.SectionsOS.Append(section1Cur); section1Cur.VerseRefStart = section1Cur.VerseRefMin = new BCVRef(1, 1, 1).BBCCCVVV; section1Cur.VerseRefEnd = section1Cur.VerseRefMax = new BCVRef(1, 1, 5).BBCCCVVV; ScrSection section2Cur = new ScrSection(); genesis.SectionsOS.Append(section2Cur); section2Cur.VerseRefStart = section2Cur.VerseRefMin = new BCVRef(1, 1, 1).BBCCCVVV; section2Cur.VerseRefEnd = section2Cur.VerseRefMax = new BCVRef(1, 1, 20).BBCCCVVV; DummyScrBook savedGenesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddArchiveBookToMockedScripture(1, "Genesis").Hvo); ScrSection section1Saved = new ScrSection(); savedGenesis.SectionsOS.Append(section1Saved); section1Saved.VerseRefStart = section1Saved.VerseRefMin = new BCVRef(1, 1, 1).BBCCCVVV; section1Saved.VerseRefEnd = section1Saved.VerseRefMax = new BCVRef(1, 1, 20).BBCCCVVV; string sDetails; List<IScrSection> sectionsToRemove; List<int> missingBtWs; Assert.AreEqual(OverwriteType.FullNoDataLoss, genesis.DetermineOverwritability(savedGenesis, out sDetails, out sectionsToRemove, out missingBtWs)); Assert.IsNull(sectionsToRemove); }
public void DetermineOverwritability_FullNoDataLoss_MatchingHoles() { DummyScrBook genesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis").Hvo); ScrSection sectionCur = new ScrSection(); genesis.SectionsOS.Append(sectionCur); sectionCur.VerseRefStart = sectionCur.VerseRefMin = new BCVRef(1, 1, 1).BBCCCVVV; sectionCur.VerseRefEnd = sectionCur.VerseRefMax = new BCVRef(1, 1, 15).BBCCCVVV; sectionCur = new ScrSection(); genesis.SectionsOS.Append(sectionCur); sectionCur.VerseRefStart = sectionCur.VerseRefMin = new BCVRef(1, 1, 19).BBCCCVVV; sectionCur.VerseRefEnd = sectionCur.VerseRefMax = new BCVRef(1, 1, 27).BBCCCVVV; DummyScrBook savedGenesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddArchiveBookToMockedScripture(1, "Genesis").Hvo); ScrSection sectionSaved = new ScrSection(); savedGenesis.SectionsOS.Append(sectionSaved); sectionSaved.VerseRefStart = sectionSaved.VerseRefMin = new BCVRef(1, 1, 1).BBCCCVVV; sectionSaved.VerseRefEnd = sectionSaved.VerseRefMax = new BCVRef(1, 1, 10).BBCCCVVV; sectionSaved = new ScrSection(); savedGenesis.SectionsOS.Append(sectionSaved); sectionSaved.VerseRefStart = sectionSaved.VerseRefMin = new BCVRef(1, 1, 11).BBCCCVVV; sectionSaved.VerseRefEnd = sectionSaved.VerseRefMax = new BCVRef(1, 1, 15).BBCCCVVV; sectionSaved = new ScrSection(); savedGenesis.SectionsOS.Append(sectionSaved); sectionSaved.VerseRefStart = sectionSaved.VerseRefMin = new BCVRef(1, 1, 19).BBCCCVVV; sectionSaved.VerseRefEnd = sectionSaved.VerseRefMax = new BCVRef(1, 1, 27).BBCCCVVV; string sDetails; List<IScrSection> sectionsToRemove; List<int> missingBtWs; Assert.AreEqual(OverwriteType.FullNoDataLoss, genesis.DetermineOverwritability(savedGenesis, out sDetails, out sectionsToRemove, out missingBtWs), "Should be ok to overwrite with saved book that contains a matching hole"); Assert.IsNull(sectionsToRemove); }
public void DetermineOverwritability_FullNoDataLoss_IdenticalHoleAtEndOfChapter() { DummyScrBook genesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis").Hvo); ScrSection sectionCur = new ScrSection(); genesis.SectionsOS.Append(sectionCur); sectionCur.VerseRefStart = sectionCur.VerseRefMin = new BCVRef(1, 1, 1).BBCCCVVV; sectionCur.VerseRefEnd = sectionCur.VerseRefMax = new BCVRef(1, 1, 30).BBCCCVVV; sectionCur = new ScrSection(); genesis.SectionsOS.Append(sectionCur); sectionCur.VerseRefStart = sectionCur.VerseRefMin = new BCVRef(1, 2, 1).BBCCCVVV; sectionCur.VerseRefEnd = sectionCur.VerseRefMax = new BCVRef(1, 2, 25).BBCCCVVV; // Since we want identical holes and section ranges, we can pass the exact same // ScrBook object as both the current and the revision. string sDetails; List<IScrSection> sectionsToRemove; List<int> missingBtWs; Assert.AreEqual(OverwriteType.FullNoDataLoss, genesis.DetermineOverwritability(genesis, out sDetails, out sectionsToRemove, out missingBtWs), "Should be ok to overwrite with saved book that contains identical hole"); Assert.IsNull(sectionsToRemove); }
public void DetermineOverwritability_FullNoDataLoss_MatchingScrSectionsButOnlySavedHasIntroSection() { DummyScrBook genesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis").Hvo); ScrSection section1Cur = new ScrSection(); genesis.SectionsOS.Append(section1Cur); section1Cur.VerseRefStart = section1Cur.VerseRefMin = new BCVRef(1, 1, 1).BBCCCVVV; section1Cur.VerseRefEnd = section1Cur.VerseRefMax = new BCVRef(1, 1, 31).BBCCCVVV; ScrSection section2Cur = new ScrSection(); genesis.SectionsOS.Append(section2Cur); section2Cur.VerseRefStart = section2Cur.VerseRefMin = new BCVRef(1, 2, 1).BBCCCVVV; section2Cur.VerseRefEnd = section2Cur.VerseRefMax = new BCVRef(1, 2, 20).BBCCCVVV; DummyScrBook savedGenesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddArchiveBookToMockedScripture(1, "Genesis").Hvo); ScrSection introSaved1 = new ScrSection(); savedGenesis.SectionsOS.Append(introSaved1); introSaved1.VerseRefStart = introSaved1.VerseRefMin = new BCVRef(1, 1, 0).BBCCCVVV; introSaved1.VerseRefEnd = introSaved1.VerseRefMax = new BCVRef(1, 1, 0).BBCCCVVV; ScrSection section1Saved = new ScrSection(); savedGenesis.SectionsOS.Append(section1Saved); section1Saved.VerseRefStart = section1Saved.VerseRefMin = new BCVRef(1, 1, 1).BBCCCVVV; section1Saved.VerseRefEnd = section1Saved.VerseRefMax = new BCVRef(1, 1, 31).BBCCCVVV; ScrSection section2Saved = new ScrSection(); savedGenesis.SectionsOS.Append(section2Saved); section2Saved.VerseRefStart = section2Saved.VerseRefMin = new BCVRef(1, 2, 1).BBCCCVVV; section2Saved.VerseRefEnd = section2Saved.VerseRefMax = new BCVRef(1, 2, 20).BBCCCVVV; string sDetails; List<IScrSection> sectionsToRemove; List<int> missingBtWs; Assert.AreEqual(OverwriteType.FullNoDataLoss, genesis.DetermineOverwritability(savedGenesis, out sDetails, out sectionsToRemove, out missingBtWs), "Should allow overwrite when both the saved version and the current " + "version have identical Scripture sections, but the saved version also has an intro section."); Assert.IsNull(sectionsToRemove); }
public void DetermineOverwritability_FullNoDataLoss_SavedAndCurrentHaveOnlyIntroSections() { DummyScrBook genesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis").Hvo); ScrSection introCur1 = new ScrSection(); genesis.SectionsOS.Append(introCur1); introCur1.VerseRefStart = introCur1.VerseRefMin = new BCVRef(1, 1, 0).BBCCCVVV; introCur1.VerseRefEnd = introCur1.VerseRefMax = new BCVRef(1, 1, 0).BBCCCVVV; ScrSection introCur2 = new ScrSection(); genesis.SectionsOS.Append(introCur2); introCur2.VerseRefStart = introCur2.VerseRefMin = new BCVRef(1, 1, 0).BBCCCVVV; introCur2.VerseRefEnd = introCur2.VerseRefMax = new BCVRef(1, 1, 0).BBCCCVVV; DummyScrBook savedGenesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddArchiveBookToMockedScripture(1, "Genesis").Hvo); ScrSection section1saved = new ScrSection(); savedGenesis.SectionsOS.Append(section1saved); section1saved.VerseRefStart = section1saved.VerseRefMin = new BCVRef(1, 1, 0).BBCCCVVV; section1saved.VerseRefEnd = section1saved.VerseRefMax = new BCVRef(1, 1, 0).BBCCCVVV; string sDetails; List<IScrSection> sectionsToRemove; List<int> missingBtWs; Assert.AreEqual(OverwriteType.FullNoDataLoss, genesis.DetermineOverwritability(savedGenesis, out sDetails, out sectionsToRemove, out missingBtWs), "Should allow overwrite when all the sections in both the saved " + "version and the current version are intro sections."); Assert.IsNull(sectionsToRemove); }
public void DetermineOverwritability_FullNoDataLoss_SavedIsSupersetOfCurrent_SingleSection_StartAndEndDifferent() { DummyScrBook genesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis").Hvo); ScrSection section1cur = new ScrSection(); genesis.SectionsOS.Append(section1cur); section1cur.VerseRefStart = section1cur.VerseRefMin = new BCVRef(1, 2, 1).BBCCCVVV; section1cur.VerseRefEnd = section1cur.VerseRefMax = new BCVRef(1, 2, 10).BBCCCVVV; DummyScrBook savedGenesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddArchiveBookToMockedScripture(1, "Genesis").Hvo); ScrSection section1saved = new ScrSection(); savedGenesis.SectionsOS.Append(section1saved); section1saved.VerseRefStart = section1saved.VerseRefMin = new BCVRef(1, 1, 1).BBCCCVVV; section1saved.VerseRefEnd = section1saved.VerseRefMax = new BCVRef(1, 2, 18).BBCCCVVV; string sDetails; List<IScrSection> sectionsToRemove; List<int> missingBtWs; Assert.AreEqual(OverwriteType.FullNoDataLoss, genesis.DetermineOverwritability(savedGenesis, out sDetails, out sectionsToRemove, out missingBtWs), "Should allow overwrite when saved book is a superset of current"); Assert.IsNull(sectionsToRemove); }
public void DetermineOverwritability_Partial_SavedHasHolesAndExtendsBeyondCurrent() { DummyScrBook genesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis").Hvo); ScrSection sectionCur = new ScrSection(); genesis.SectionsOS.Append(sectionCur); sectionCur.VerseRefStart = sectionCur.VerseRefMin = new BCVRef(1, 1, 2).BBCCCVVV; sectionCur.VerseRefEnd = sectionCur.VerseRefMax = new BCVRef(1, 1, 8).BBCCCVVV; DummyScrBook savedGenesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddArchiveBookToMockedScripture(1, "Genesis").Hvo); ScrSection sectionSaved = new ScrSection(); savedGenesis.SectionsOS.Append(sectionSaved); sectionSaved.VerseRefStart = sectionSaved.VerseRefMin = new BCVRef(1, 1, 1).BBCCCVVV; sectionSaved.VerseRefEnd = sectionSaved.VerseRefMax = new BCVRef(1, 1, 1).BBCCCVVV; sectionSaved = new ScrSection(); savedGenesis.SectionsOS.Append(sectionSaved); sectionSaved.VerseRefStart = sectionSaved.VerseRefMin = new BCVRef(1, 1, 9).BBCCCVVV; sectionSaved.VerseRefEnd = sectionSaved.VerseRefMax = new BCVRef(1, 1, 11).BBCCCVVV; string sDetails; List<IScrSection> sectionsToRemove; List<int> missingBtWs; Assert.AreEqual(OverwriteType.Partial, genesis.DetermineOverwritability(savedGenesis, out sDetails, out sectionsToRemove, out missingBtWs), "Can perform a partial overwrite with saved book that contains a hole matched by a current section"); Assert.AreEqual(0, sectionsToRemove.Count); }
public void DetermineOverwritability_Partial_MatchingScrSections_SavedHasNoIntro() { DummyScrBook genesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis").Hvo); ScrSection introCur = new ScrSection(); genesis.SectionsOS.Append(introCur); introCur.VerseRefStart = introCur.VerseRefMin = new BCVRef(1, 1, 0).BBCCCVVV; introCur.VerseRefEnd = introCur.VerseRefMax = new BCVRef(1, 1, 0).BBCCCVVV; ScrSection section1cur = new ScrSection(); genesis.SectionsOS.Append(section1cur); section1cur.VerseRefStart = section1cur.VerseRefMin = new BCVRef(1, 1, 1).BBCCCVVV; section1cur.VerseRefEnd = section1cur.VerseRefMax = new BCVRef(1, 1, 20).BBCCCVVV; DummyScrBook savedGenesis = new DummyScrBook(Cache, m_scrInMemoryCache.AddArchiveBookToMockedScripture(1, "Genesis").Hvo); ScrSection section1saved = new ScrSection(); savedGenesis.SectionsOS.Append(section1saved); section1saved.VerseRefStart = section1saved.VerseRefMin = new BCVRef(1, 1, 1).BBCCCVVV; section1saved.VerseRefEnd = section1saved.VerseRefMax = new BCVRef(1, 1, 20).BBCCCVVV; string sDetails; List<IScrSection> sectionsToRemove; List<int> missingBtWs; Assert.AreEqual(OverwriteType.Partial, genesis.DetermineOverwritability(savedGenesis, out sDetails, out sectionsToRemove, out missingBtWs), "Can do partial overwrite with saved book that does not have intro"); Assert.AreEqual(1, sectionsToRemove.Count); Assert.AreEqual(genesis.SectionsOS.HvoArray[1], sectionsToRemove[0].Hvo); }