public void Teardown()
		{
			CheckDisposed();
			m_cache.Dispose();
			m_cache = null;
			m_ws = null;
		}
Example #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Constructor to use when using an in-memory cache
		/// </summary>
		/// <param name="settings">Import settings</param>
		/// <param name="cache">FDO Cache</param>
		/// <param name="styleSheet">A stylesheet</param>
		/// <param name="inMemoryCache"> in-memory cache (use null to test against real DB)</param>
		/// ------------------------------------------------------------------------------------
		public DummyTeImporter(ScrImportSet settings, FdoCache cache, FwStyleSheet styleSheet,
			ScrInMemoryFdoCache inMemoryCache) :
			base(settings, cache, styleSheet, new DummyUndoImportManager(inMemoryCache),
				new TeImportNoUi())
		{
			m_inMemoryCache = inMemoryCache;
		}
Example #3
0
		public void Teardown()
		{
			CheckDisposed();
			m_mock.Dispose();
			m_mock = null;
			m_lp = null;
		}
		public void SetUp()
		{
			CheckDisposed();
			if (m_cache != null)
				m_cache.Dispose();

			m_cache = InMemoryFdoCache.CreateInMemoryFdoCache();
			m_cache.InitializeWritingSystemEncodings();
			ILgWritingSystemFactory lgwsf = m_cache.Cache.LanguageWritingSystemFactoryAccessor;
			m_ws = lgwsf.get_EngineOrNull(InMemoryFdoCache.s_wsHvos.En);
		}
Example #5
0
		public void SetUp()
		{
			CheckDisposed();
			if (m_mock != null)
				m_mock.Dispose();

			m_mock = InMemoryFdoCache.CreateInMemoryFdoCache();
			m_mock.InitializeWritingSystemEncodings();
			m_mock.InitializeLangProject();
			m_lp = m_mock.Cache.LangProject;
		}
		public void Init()
		{
			StringUtils.InitIcuDataDir();
			m_inMemoryCache = InMemoryFdoCache.CreateInMemoryFdoCache();
			m_inMemoryCache.InitializeLangProject();
			m_inMemoryCache.Cache.LanguageWritingSystemFactoryAccessor.BypassInstall = true;
			m_inMemoryCache.InitializeWritingSystemEncodings();

			m_dlgWsProps = new DummyWritingSystemPropertiesDialog(m_inMemoryCache.Cache);

			// "show" the dialog box (the actually gui will never be loaded)
			// When in test mode the dialog will not call its base ShowDialog
			m_dlgWsProps.CallShowDialog();
		}
Example #7
0
		/// <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 virtual void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (m_isDisposed)
				return;

			if (disposing)
			{
				// Dispose managed resources here.
				if (m_app != null)
					m_app.Dispose(); // Ensure cache disposed and WSF shutdown.
				if (m_inMemoryCache != null)
					m_inMemoryCache.Dispose();
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_app = null;
			m_mainWnd = null;
			m_inMemoryCache = null;

			m_isDisposed = true;
		}
Example #8
0
		public override void Exit()
		{
			CheckDisposed();

			m_inMemoryCache.Dispose();
			m_inMemoryCache = null;

			base.Exit();
		}
Example #9
0
		public override void Initialize()
		{
			CheckDisposed();

			Debug.Assert(m_inMemoryCache == null, "m_inMemoryCache is not null, but should be.");
			//if (m_inMemoryCache != null)
			//	m_inMemoryCache.Dispose();
			m_inMemoryCache = CreateInMemoryFdoCache(this);
			m_inMemoryCache.InitializeLangProject();
			m_inMemoryCache.InitializeActionHandler();
			InitializeCache();

			base.Initialize();

			CreateTestData();
		}
Example #10
0
		/// <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_inMemoryCache != null)
				{
					if (m_inMemoryCache != null)
						m_inMemoryCache.Dispose();
				}
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_inMemoryCache = null;

			base.Dispose(disposing);
		}
		public void Init()
		{
			m_inMemoryCache = InMemoryFdoCache.CreateInMemoryFdoCache();
			m_inMemoryCache.InitializeLangProject();
		}
Example #12
0
		/// ------------------------------------------------------------------------------------
		/// <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.
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_inMemoryCache = null; // FwStyleSheet should implement IDisposable.
		}
Example #13
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Constructor to use when using a DB-based cache
		/// </summary>
		/// <param name="settings">Import settings</param>
		/// <param name="cache">FDO Cache</param>
		/// <param name="styleSheet">A stylesheet</param>
		/// ------------------------------------------------------------------------------------
		public DummyTeImporter(ScrImportSet settings, FdoCache cache, FwStyleSheet styleSheet)
			: base(settings, cache, styleSheet, new UndoImportManager(cache, null),
			new TeImportNoUi())
		{
			m_inMemoryCache = null;
		}
Example #14
0
		public void SetUp()
		{
			CheckDisposed();

			m_inMemoryCache = InMemoryFdoCache.CreateInMemoryFdoCache();
			m_mainWnd = new DynamicMock(typeof(IFwMainWnd));
			m_mainWnd.SetupResult("Cache", Cache);
			m_app = new DummyFwApp();
		}
		public void Init()
		{
			m_inMemoryCache = InMemoryFdoCache.CreateInMemoryFdoCache();
			m_inMemoryCache.InitializeLangProject();
			m_inMemoryCache.Cache.LanguageWritingSystemFactoryAccessor.BypassInstall = true;
			m_inMemoryCache.InitializeWritingSystemEncodings();
			int hvoWsNew = SimulateInstallLanguage("xkal__IPA", "Kalaba (IPA)",
				"Arial", "Times New Roman", "Charis SIL");
			m_hvoWsKalabaIpa = hvoWsNew;
			CreateTempLanguageDefinitionFileFromWs(InMemoryFdoCache.s_wsHvos.XKal);
			CreateTempLanguageDefinitionFileFromWs(m_hvoWsKalabaIpa);
			CreateTempLanguageDefinitionFileFromNewWs("xwsd", "WSDialog",
				"Arial", "Courier New", "Charis SIL");
			CreateTempLanguageDefinitionFileFromNewWs("xwsd__IPA", "WSDialog (IPA)",
				"Doulos SIL", "Doulos SIL", "Doulos SIL");
			DummyWritingSystemPropertiesDialog.CopyLangDefToTempLanguageDir("xtst",
				Path.Combine(DirectoryFinder.FwSourceDirectory, @"FwCoreDlgs\FwCoreDlgsTests\xtst.xml"));
			m_dlg = new DummyWritingSystemPropertiesDialog(m_inMemoryCache.Cache);
		}
Example #16
0
		public void TearDown()
		{
			CheckDisposed();

			// Note: m_inMemoryCache has to be dispsoed first,
			// and then the app can be disposed.
			// Otherwise, m_inMemoryCache can't do waht it wants with
			// its NewFdoCache object, as it will already have been disposed.
			if (m_inMemoryCache != null)
			{
				m_inMemoryCache.Dispose();
				m_inMemoryCache = null;
			}
			if (m_app != null)
			{
				m_app.Dispose(); // Ensure cache disposed and WSF shutdown.
				m_app = null;
			}
			m_mainWnd = null;
		}
Example #17
0
		/// <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_mock != null)
					m_mock.Dispose();
				string langFilesPath = Path.Combine(DirectoryFinder.FWDataDirectory, "Languages");
				// Delete any language files created by these tests.
				foreach (string filename in Directory.GetFiles(langFilesPath, "*.xml"))
					File.Delete(filename);
				// Restore any backed up XML files in the Languages folder to their original names
				foreach (string filename in Directory.GetFiles(langFilesPath, "*.xml.BAK"))
					File.Move(filename, filename.Replace(".xml.BAK", ".xml"));
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_mock = null;
			m_lp = null;

			base.Dispose(disposing);
		}