/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes import settings (mappings and options) for "Other" type of import. /// Individual test fixtures can override for other types of import. /// </summary> /// ------------------------------------------------------------------------------------ protected virtual void InitializeImportSettings() { DummyTeImporter.MakeSFImportTestSettings(m_settings); m_settings.ImportBackTranslation = false; m_settings.ImportBookIntros = true; m_settings.ImportAnnotations = false; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> /// ------------------------------------------------------------------------------------ protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { // Dispose managed resources here. if (m_importer != null) { m_importer.Dispose(); } } // Dispose unmanaged resources here, whether disposing is true or false. m_styleSheet = null; // FwStyleSheet should implement IDisposable. m_settings = null; m_importer = null; // TeImporter should implement IDisposable. if (m_ttpVernWS != null) { // Marshal.ReleaseComObject(m_ttpVernWS); m_ttpVernWS = null; } if (m_ttpAnalWS != null) { // Marshal.ReleaseComObject(m_ttpAnalWS); m_ttpAnalWS = null; } base.Dispose(disposing); }
public override void Exit() { CheckDisposed(); m_importer.Dispose(); m_importer = null; m_styleSheet = null; m_settings = null; base.Exit(); }
public override void TestTearDown() { if (m_actionHandler.CurrentDepth > 0) { m_importer.UndoInfo.DoneImportingFiles(true); } m_importer.Dispose(); m_importer = null; m_styleSheet = null; m_settings = null; // Restart an undo task so we don't crash :) m_actionHandler.BeginUndoTask("bla", "bla"); base.TestTearDown(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initialize the importer /// </summary> /// ------------------------------------------------------------------------------------ public override void TestSetup() { base.TestSetup(); m_styleSheet = new FwStyleSheet(); m_styleSheet.Init(Cache, m_scr.Hvo, ScriptureTags.kflidStyles); InitWsInfo(); DummyTeImporter.s_translatorNoteDefn = Cache.ServiceLocator.GetInstance <ICmAnnotationDefnRepository>().TranslatorAnnotationDefn; DummyTeImporter.s_consultantNoteDefn = Cache.ServiceLocator.GetInstance <ICmAnnotationDefnRepository>().ConsultantAnnotationDefn; m_titus = new BCVRef(56001001); m_settings = m_scr.FindOrCreateDefaultImportSettings(TypeOfImport.Other); m_settings.StartRef = m_titus; m_settings.EndRef = m_titus; m_settings.ImportTranslation = true; InitializeImportSettings(); m_actionHandler.EndUndoTask(); // Let the importer handle the undo/redo m_importer = new DummyTeImporter(m_settings, this, m_styleSheet); m_importer.Initialize(); m_importer.UndoInfo.StartImportingFiles(); }
public override void Initialize() { base.Initialize(); m_styleSheet = new FwStyleSheet(); m_styleSheet.Init(Cache, m_scr.Hvo, (int)Scripture.ScriptureTags.kflidStyles); InitWsInfo(); DummyTeImporter.s_translatorNoteDefn = m_scrInMemoryCache.m_translatorNoteDefn; DummyTeImporter.s_consultantNoteDefn = m_scrInMemoryCache.m_consultantNoteDefn; m_titus = new BCVRef(56001001); m_settings = new DummyScrImportSet(); m_scr.ImportSettingsOC.Add(m_settings); m_settings.ImportTypeEnum = TypeOfImport.Other; m_settings.StartRef = m_titus; m_settings.EndRef = m_titus; m_settings.ImportTranslation = true; InitializeImportSettings(); m_importer = new DummyTeImporter(m_settings, Cache, m_styleSheet, m_scrInMemoryCache); m_importer.Initialize(); }