Ejemplo n.º 1
0
        public void Overwrite()
        {
            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.m_typeOfOverwrite = OverwriteType.FullNoDataLoss;
                importedBooks.SimulateOverwrite();
                Assert.AreEqual(ImportedBooks.ImportedBookStatus.Overwritten, importedBooks.GetStatus(0));
            }

            Assert.AreEqual("Book of Genesis",
                            ((StTxtPara)m_scr.ScriptureBooksOS[0].TitleOA.ParagraphsOS[0]).Contents.Text);
        }
Ejemplo n.º 2
0
        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 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);
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 7
0
		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);
		}
Ejemplo n.º 8
0
		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);
			}
		}
Ejemplo n.º 9
0
		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);
		}
Ejemplo n.º 10
0
		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);
		}
Ejemplo n.º 11
0
		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);
			}
		}
Ejemplo n.º 12
0
		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);
		}