예제 #1
0
        public void CheckScrPsgRefPersistence()
        {
            m_dlg.ImportEntireProject = false;

            m_dlg.StartRef = new BCVRef(2, 8, 20);
            m_dlg.EndRef   = new BCVRef(8, 2, 4);

            m_dlg.Show();

            try
            {
                Assert.AreEqual("EXO 8:20", m_dlg.StartRef.AsString);
                Assert.AreEqual("RUT 2:4", m_dlg.EndRef.AsString);

                // This needs to happen to force the current control content to be saved in
                // static variables.
                m_dlg.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            finally
            {
                if (m_dlg != null && m_dlg.Visible)
                {
                    m_dlg.Close();
                }
            }

            // Now dispose of the dialog and reinstantiate it. The reinstantiated version
            // should still contain the Exodus and Ruth references.
            m_dlg = new DummyImportDialog(null, Cache, m_settings);
            m_dlg.ImportEntireProject = false;

            Assert.AreEqual("EXO 1:1", m_dlg.StartRef.AsString);
            Assert.AreEqual("RUT 1:1", m_dlg.EndRef.AsString);

            // If we ever support partial-book imports, use these assertions instead:
            //Assert.AreEqual("EXO 8:20", m_dlg.StartRef.AsString);
            //Assert.AreEqual("RUT 2:4", m_dlg.EndRef.AsString);
        }