/// ------------------------------------------------------------------------------------ /// <summary> /// Overrides DisplayImportedBooksDlg for testing - just accepts . /// </summary> /// <param name="backupSavedVersion">The saved version for backups of any overwritten /// books.</param> /// ------------------------------------------------------------------------------------ protected override void DisplayImportedBooksDlg(IScrDraft backupSavedVersion) { #if WANTTESTPORT // (TE) Do we still need this? (see below) DummyImportedBooks dlg = new DummyImportedBooks(m_cache, ImportedSavedVersion, backupSavedVersion); dlg.AcceptAllImportedBooks(); #endif }
public void Overwrite() { AddSection(m_scr.ScriptureBooksOS[0], 1, 1, 15); AddSection(m_importedVersion.BooksOS[0], 1, 1, 15); // We have to end an Undo task because another one is within the btnOverwrite_Click method // called from SimulateOverwrite. m_actionHandler.EndUndoTask(); using (DummyImportedBooks importedBooks = new DummyImportedBooks(Cache, m_importedVersion, m_savedVersion)) { importedBooks.m_typeOfOverwrite = OverwriteType.FullNoDataLoss; importedBooks.SimulateOverwrite(); Assert.AreEqual(ImportedBooks.ImportedBookStatus.Overwritten, importedBooks.GetStatus(0)); } Assert.AreEqual("Book of Genesis", m_scr.ScriptureBooksOS[0].TitleOA[0].Contents.Text); }
// To whoever "we" is: MarkP said that, for the user, knowing that the intro material is present is as important as a range of Scripture. //[Ignore("We don't think it's very useful to indicate whether or not the imported book has an introduction.")] public void GetBookInfo_FirstPartMissingWithIntro() { IScrSection introSection = m_scrInMemoryCache.AddSectionToMockedBook( m_importedVersion.BooksOS[0].Hvo, true); IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(m_importedVersion.BooksOS[0].Hvo); StTxtPara para = AddPara(section); AddVerse(para, 1, 2, "NOT the first verse in Genesis"); AddVerse(para, 50, 25, "NOT the last verse in Genesis"); section.AdjustReferences(); using (DummyImportedBooks importedBooks = new DummyImportedBooks(Cache, m_importedVersion, m_savedVersion)) { string bookName = (string)ReflectionHelper.GetStrResult(typeof(ImportedBooks), "GetBookInfo", m_importedVersion.BooksOS[0]); Assert.AreEqual("1:2-50:25 (with intro)", bookName); } }
public void Overwrite_Partial() { AddSection(m_scr.ScriptureBooksOS[0], 1, 1, 15); AddSection(m_importedVersion.BooksOS[0], 1, 1, 15); // Add a new section to the current that is not in the revision so that a partial overwrite // will be done. AddSection(m_scr.ScriptureBooksOS[0], 2, 1, 20); using (DummyImportedBooks importedBooks = new DummyImportedBooks(Cache, m_importedVersion, m_savedVersion)) { importedBooks.m_typeOfOverwrite = OverwriteType.Partial; importedBooks.SimulateOverwrite(); Assert.AreEqual(0, ((List <int>)ReflectionHelper.GetField(importedBooks, "m_newBooks")).Count); Assert.AreEqual(0, ((List <int>)ReflectionHelper.GetField(importedBooks, "m_overwrittenBooks")).Count); Assert.AreEqual(ImportedBooks.ImportedBookStatus.Overwritten, importedBooks.GetStatus(0)); Assert.IsTrue(importedBooks.m_fPartialOverwriteWasCalled); } }
public void NewBookImported() { m_scr.ScriptureBooksOS.Clear(); #pragma warning disable 219 IScrSection section = AddSectionToMockedBook(m_importedVersion.BooksOS[0]); #pragma warning restore 219 // We have to end an Undo task because another one is within the ImportedBooks // constructor. m_actionHandler.EndUndoTask(); using (DummyImportedBooks importedBooks = new DummyImportedBooks(Cache, m_importedVersion, m_savedVersion)) { Assert.AreEqual(ImportedBooks.ImportedBookStatus.New, importedBooks.GetStatus(0)); ReflectionHelper.CallMethod(importedBooks, "UpdateButtonStatus", (BookMerger)null); Button btnOverwrite = (Button)ReflectionHelper.GetField(importedBooks, "btnOverwrite"); Assert.IsFalse(btnOverwrite.Enabled, "The overwrite button should be disabled for new books."); Button btnCompare = (Button)ReflectionHelper.GetField(importedBooks, "btnCompare"); Assert.IsFalse(btnCompare.Enabled, "The compare button should be disabled for new books."); } Assert.AreEqual(1, m_scr.ScriptureBooksOS.Count); }
public void Overwrite_Partial() { AddSection(m_scr.ScriptureBooksOS[0], 1, 1, 15); AddSection(m_importedVersion.BooksOS[0], 1, 1, 15); // Add a new section to the current that is not in the revision so that a partial overwrite // will be done. AddSection(m_scr.ScriptureBooksOS[0], 2, 1, 20); // We have to end an Undo task because another one is within the btnOverwrite_Click method // called from SimulateOverwrite. m_actionHandler.EndUndoTask(); using (DummyImportedBooks importedBooks = new DummyImportedBooks(Cache, m_importedVersion, m_savedVersion)) { importedBooks.m_typeOfOverwrite = OverwriteType.Partial; importedBooks.SimulateOverwrite(); Assert.AreEqual(0, ((List <IScrBook>)ReflectionHelper.GetField(importedBooks, "m_newBooks")).Count); Assert.AreEqual(0, ((List <IScrBook>)ReflectionHelper.GetField(importedBooks, "m_overwrittenBooks")).Count); Assert.AreEqual(ImportedBooks.ImportedBookStatus.Overwritten, importedBooks.GetStatus(0)); Assert.IsTrue(importedBooks.m_fPartialOverwriteWasCalled); } }
public void Overwrite_Partial() { AddSection(m_scr.ScriptureBooksOS[0], 1, 1, 15); AddSection(m_importedVersion.BooksOS[0], 1, 1, 15); // Add a new section to the current that is not in the revision so that a partial overwrite // will be done. AddSection(m_scr.ScriptureBooksOS[0], 2, 1, 20); using (DummyImportedBooks importedBooks = new DummyImportedBooks(Cache, m_importedVersion, m_savedVersion)) { importedBooks.m_typeOfOverwrite = OverwriteType.Partial; importedBooks.SimulateOverwrite(); Assert.AreEqual(0, ((List<int>)ReflectionHelper.GetField(importedBooks, "m_newBooks")).Count); Assert.AreEqual(0, ((List<int>)ReflectionHelper.GetField(importedBooks, "m_overwrittenBooks")).Count); Assert.AreEqual(ImportedBooks.ImportedBookStatus.Overwritten, importedBooks.GetStatus(0)); Assert.IsTrue(importedBooks.m_fPartialOverwriteWasCalled); } }
// To whoever "we" is: MarkP said that, for the user, knowing that the intro material is present is as important as a range of Scripture. //[Ignore("We don't think it's very useful to indicate whether or not the imported book has an introduction.")] public void GetBookInfo_IntroOnly() { IScrSection introSection = m_scrInMemoryCache.AddSectionToMockedBook( m_importedVersion.BooksOS[0].Hvo, true); using (DummyImportedBooks importedBooks = new DummyImportedBooks(Cache, m_importedVersion, m_savedVersion)) { string bookName = (string)ReflectionHelper.GetStrResult(typeof(ImportedBooks), "GetBookInfo", m_importedVersion.BooksOS[0]); Assert.AreEqual("(intro only)", bookName); } }
public void OverwriteAfterCompare() { AddSection(m_scr.ScriptureBooksOS[0], 1, 1, 15); AddSection(m_importedVersion.BooksOS[0], 1, 1, 15); using (DummyImportedBooks importedBooks = new DummyImportedBooks(Cache, m_importedVersion, m_savedVersion)) { importedBooks.SimulateCompare(); // We have to end an Undo task because another one is within the btnOverwrite_Click method // called from SimulateOverwrite. m_actionHandler.EndUndoTask(); importedBooks.m_typeOfOverwrite = OverwriteType.FullNoDataLoss; importedBooks.SimulateOverwrite(); Assert.AreEqual("Genesis", importedBooks.m_sOverwriteWillBlowAwayMergedBook); Assert.AreEqual(ImportedBooks.ImportedBookStatus.Overwritten, importedBooks.GetStatus(0)); } Assert.AreEqual("Book of Genesis", m_scr.ScriptureBooksOS[0].TitleOA[0].Contents.Text); }
public void GetBookInfo_FullBookWithoutIntro() { IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(m_importedVersion.BooksOS[0].Hvo); StTxtPara para = AddPara(section); AddVerse(para, 1, 1, "first verse in Genesis"); AddVerse(para, 50, 26, "last verse in Genesis"); section.AdjustReferences(); using (DummyImportedBooks importedBooks = new DummyImportedBooks(Cache, m_importedVersion, m_savedVersion)) { string bookName = (string)ReflectionHelper.GetStrResult(typeof(ImportedBooks), "GetBookInfo", m_importedVersion.BooksOS[0]); Assert.AreEqual("1:1-50:26", bookName); } }
// To whoever "we" is: MarkP said that, for the user, knowing that the intro material is present is as important as a range of Scripture. //[Ignore("We don't think it's very useful to indicate whether or not the imported book has an introduction.")] public void GetBookInfo_FirstPartMissingWithIntro() { IScrSection introSection = m_scrInMemoryCache.AddSectionToMockedBook( m_importedVersion.BooksOS[0].Hvo, true); IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(m_importedVersion.BooksOS[0].Hvo); StTxtPara para = AddPara(section); AddVerse(para, 1, 2, "NOT the first verse in Genesis"); AddVerse(para, 50, 25, "NOT the last verse in Genesis"); section.AdjustReferences(); using (DummyImportedBooks importedBooks = new DummyImportedBooks(Cache, m_importedVersion, m_savedVersion)) { string bookName = (string)ReflectionHelper.GetStrResult(typeof(ImportedBooks), "GetBookInfo", m_importedVersion.BooksOS[0]); Assert.AreEqual("1:2-50:25 (with intro)", bookName); } }
public void Overwrite_Partial() { AddSection(m_scr.ScriptureBooksOS[0], 1, 1, 15); AddSection(m_importedVersion.BooksOS[0], 1, 1, 15); // Add a new section to the current that is not in the revision so that a partial overwrite // will be done. AddSection(m_scr.ScriptureBooksOS[0], 2, 1, 20); // We have to end an Undo task because another one is within the btnOverwrite_Click method // called from SimulateOverwrite. m_actionHandler.EndUndoTask(); using (DummyImportedBooks importedBooks = new DummyImportedBooks(Cache, m_importedVersion, m_savedVersion)) { importedBooks.m_typeOfOverwrite = OverwriteType.Partial; importedBooks.SimulateOverwrite(); Assert.AreEqual(0, ((List<IScrBook>)ReflectionHelper.GetField(importedBooks, "m_newBooks")).Count); Assert.AreEqual(0, ((List<IScrBook>)ReflectionHelper.GetField(importedBooks, "m_overwrittenBooks")).Count); Assert.AreEqual(ImportedBooks.ImportedBookStatus.Overwritten, importedBooks.GetStatus(0)); Assert.IsTrue(importedBooks.m_fPartialOverwriteWasCalled); } }
public void NewBookImported() { m_scr.ScriptureBooksOS.RemoveAll(); IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(m_importedVersion.BooksOS[0].Hvo); using (DummyImportedBooks importedBooks = new DummyImportedBooks(Cache, m_importedVersion, m_savedVersion)) { Assert.AreEqual(ImportedBooks.ImportedBookStatus.New, importedBooks.GetStatus(0)); ReflectionHelper.CallMethod(importedBooks, "UpdateButtonStatus", (BookMerger)null); Button btnOverwrite = (Button)ReflectionHelper.GetField(importedBooks, "btnOverwrite"); Assert.IsFalse(btnOverwrite.Enabled, "The overwrite button should be disabled for new books."); Button btnCompare = (Button)ReflectionHelper.GetField(importedBooks, "btnCompare"); Assert.IsFalse(btnCompare.Enabled, "The compare button should be disabled for new books."); } Assert.AreEqual(1, m_scr.ScriptureBooksOS.Count); }
public void OverwriteAfterCompare() { AddSection(m_scr.ScriptureBooksOS[0], 1, 1, 15); AddSection(m_importedVersion.BooksOS[0], 1, 1, 15); using (DummyImportedBooks importedBooks = new DummyImportedBooks(Cache, m_importedVersion, m_savedVersion)) { importedBooks.SimulateCompare(); importedBooks.m_typeOfOverwrite = OverwriteType.FullNoDataLoss; importedBooks.SimulateOverwrite(); Assert.AreEqual("Genesis", importedBooks.m_sOverwriteWillBlowAwayMergedBook); Assert.AreEqual(ImportedBooks.ImportedBookStatus.Overwritten, importedBooks.GetStatus(0)); } Assert.AreEqual("Book of Genesis", ((StTxtPara)m_scr.ScriptureBooksOS[0].TitleOA.ParagraphsOS[0]).Contents.Text); }
// To whoever "we" is: MarkP said that, for the user, knowing that the intro material is present is as important as a range of Scripture. //[Ignore("We don't think it's very useful to indicate whether or not the imported book has an introduction.")] public void GetBookInfo_IntroOnly() { #pragma warning disable 219 IScrSection introSection = AddSectionToMockedBook(m_importedVersion.BooksOS[0], true); #pragma warning restore 219 using (DummyImportedBooks importedBooks = new DummyImportedBooks(Cache, m_importedVersion, m_savedVersion)) { string bookName = (string)ReflectionHelper.GetStrResult(typeof(ImportedBooks), "GetBookInfo", m_importedVersion.BooksOS[0]); Assert.AreEqual("(intro only)", bookName); } }
// To whoever "we" is: MarkP said that, for the user, knowing that the intro material is present is as important as a range of Scripture. //[Ignore("We don't think it's very useful to indicate whether or not the imported book has an introduction.")] public void GetBookInfo_FirstPartMissingWithIntro() { #pragma warning disable 219 IScrSection introSection = AddSectionToMockedBook(m_importedVersion.BooksOS[0], true); #pragma warning restore 219 IScrSection section = AddSectionToMockedBook(m_importedVersion.BooksOS[0]); IScrTxtPara para = AddParaToMockedSectionContent(section, ScrStyleNames.NormalParagraph); AddVerse(para, 1, 2, "NOT the first verse in Genesis"); AddVerse(para, 50, 25, "NOT the last verse in Genesis"); using (DummyImportedBooks importedBooks = new DummyImportedBooks(Cache, m_importedVersion, m_savedVersion)) { string bookName = (string)ReflectionHelper.GetStrResult(typeof(ImportedBooks), "GetBookInfo", m_importedVersion.BooksOS[0]); Assert.AreEqual("1:2-50:25 (with intro)", bookName); } }
public void GetBookInfo_LastPartMissing() { IScrSection section = AddSectionToMockedBook(m_importedVersion.BooksOS[0]); IScrTxtPara para = AddParaToMockedSectionContent(section, ScrStyleNames.NormalParagraph); AddVerse(para, 1, 1, "first verse in Genesis"); AddVerse(para, 50, 25, "NOT the last verse in Genesis"); using (DummyImportedBooks importedBooks = new DummyImportedBooks(Cache, m_importedVersion, m_savedVersion)) { string bookName = (string)ReflectionHelper.GetStrResult(typeof(ImportedBooks), "GetBookInfo", m_importedVersion.BooksOS[0]); Assert.AreEqual("1:1-50:25", bookName); } }
public void NewBookImported() { m_scr.ScriptureBooksOS.Clear(); #pragma warning disable 219 IScrSection section = AddSectionToMockedBook(m_importedVersion.BooksOS[0]); #pragma warning restore 219 // We have to end an Undo task because another one is within the ImportedBooks // constructor. m_actionHandler.EndUndoTask(); using (DummyImportedBooks importedBooks = new DummyImportedBooks(Cache, m_importedVersion, m_savedVersion)) { Assert.AreEqual(ImportedBooks.ImportedBookStatus.New, importedBooks.GetStatus(0)); ReflectionHelper.CallMethod(importedBooks, "UpdateButtonStatus", (BookMerger)null); Button btnOverwrite = (Button)ReflectionHelper.GetField(importedBooks, "btnOverwrite"); Assert.IsFalse(btnOverwrite.Enabled, "The overwrite button should be disabled for new books."); Button btnCompare = (Button)ReflectionHelper.GetField(importedBooks, "btnCompare"); Assert.IsFalse(btnCompare.Enabled, "The compare button should be disabled for new books."); } Assert.AreEqual(1, m_scr.ScriptureBooksOS.Count); }