/// ------------------------------------------------------------------------------------
 /// <summary>
 /// If a test overrides this, it should call this base implementation.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 public override void FixtureTeardown()
 {
     m_ptHelper.Dispose();
     m_ptHelper = null;
     base.FixtureTeardown();
     ParatextHelper.Manager.Reset();
 }
예제 #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// If a test overrides this, it should call this base implementation.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void FixtureTeardown()
		{
			m_ptHelper.Dispose();
			m_ptHelper = null;
			base.FixtureTeardown();
			ParatextHelper.Manager.Reset();
		}
예제 #3
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// If a test overrides this, it should call this base implementation.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 public override void FixtureTeardown()
 {
     m_ptHelper.Dispose();
     m_ptHelper = null;
     base.FixtureTeardown();
     ParatextHelper.Manager.Reset();
     ScriptureProvider._scriptureProvider = m_oldProvider;
 }
예제 #4
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Squeezes in the mock ParatextHelper in place of the real adapter.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 public override void FixtureSetup()
 {
     base.FixtureSetup();
     m_oldProvider = ScriptureProvider._scriptureProvider;
     ScriptureProvider._scriptureProvider = new MockScriptureProvider();
     m_ptHelper = new MockParatextHelper();
     ParatextHelper.Manager.SetParatextHelperAdapter(m_ptHelper);
 }
        public void ImportProjectIsAccessible_Paratext6()
        {
            IScrImportSet importSettings = Cache.ServiceLocator.GetInstance <IScrImportSetFactory>().Create();

            Cache.LanguageProject.TranslatedScriptureOA.ImportSettingsOC.Add(importSettings);
            importSettings.ImportTypeEnum = TypeOfImport.Paratext6;

            var fileOs = new MockFileOS();
            MockParatextHelper ptHelper = null;
            var saveScriptureProvider   = ScriptureProvider._scriptureProvider;

            ScriptureProvider._scriptureProvider = new MockScriptureProvider();
            try
            {
                FileUtils.Manager.SetFileAdapter(fileOs);
                ptHelper = new MockParatextHelper();
                ParatextHelper.Manager.SetParatextHelperAdapter(ptHelper);
                string paratextDir = ScriptureProvider.SettingsDirectory;
                Assert.NotNull(paratextDir, "Setup problem - ProjectsDirectory should not be null.");
                ptHelper.AddProject("TEV", null, null, true, false, "100001");

                fileOs.AddExistingFile(Path.Combine(paratextDir, "TEV.ssf"));

                importSettings.ParatextScrProj = "KAM";
                importSettings.ParatextBTProj  = "TEV";

                StringCollection projectsNotFound;
                Assert.IsFalse(importSettings.ImportProjectIsAccessible(out projectsNotFound));
                Assert.AreEqual(1, projectsNotFound.Count);
                Assert.AreEqual("KAM", projectsNotFound[0]);

                fileOs.AddExistingFile(Path.Combine(paratextDir, "KAM.ssf"));
                ptHelper.AddProject("KAM", null, null, true, false, "000101");
                Assert.IsTrue(importSettings.ImportProjectIsAccessible(out projectsNotFound));
            }
            finally
            {
                ParatextHelper.Manager.Reset();
                if (ptHelper != null)
                {
                    ptHelper.Dispose();
                }
                FileUtils.Manager.Reset();
                ScriptureProvider._scriptureProvider = saveScriptureProvider;
            }
        }
		public void ImportProjectIsAccessible_Paratext6()
		{
			IScrImportSet importSettings = Cache.ServiceLocator.GetInstance<IScrImportSetFactory>().Create();
			Cache.LanguageProject.TranslatedScriptureOA.ImportSettingsOC.Add(importSettings);
			importSettings.ImportTypeEnum = TypeOfImport.Paratext6;

			var fileOs = new MockFileOS();
			MockParatextHelper ptHelper = null;
			try
			{
				FileUtils.Manager.SetFileAdapter(fileOs);
				ptHelper = new MockParatextHelper();
				ParatextHelper.Manager.SetParatextHelperAdapter(ptHelper);
				string paratextDir = ParatextHelper.ProjectsDirectory;

				ptHelper.AddProject("TEV", null, null, true, false, "100001");

				fileOs.AddExistingFile(Path.Combine(paratextDir, "TEV.ssf"));

				importSettings.ParatextScrProj = "KAM";
				importSettings.ParatextBTProj = "TEV";

				StringCollection projectsNotFound;
				Assert.IsFalse(importSettings.ImportProjectIsAccessible(out projectsNotFound));
				Assert.AreEqual(1, projectsNotFound.Count);
				Assert.AreEqual("KAM", projectsNotFound[0]);

				fileOs.AddExistingFile(Path.Combine(paratextDir, "KAM.ssf"));
				ptHelper.AddProject("KAM", null, null, true, false, "000101");
				Assert.IsTrue(importSettings.ImportProjectIsAccessible(out projectsNotFound));
			}
			finally
			{
				ParatextHelper.Manager.Reset();
				if (ptHelper != null)
					ptHelper.Dispose();
				FileUtils.Manager.Reset();
			}
		}
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Squeezes in the mock ParatextHelper in place of the real adapter.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 public override void FixtureSetup()
 {
     base.FixtureSetup();
     m_ptHelper = new MockParatextHelper();
     ParatextHelper.Manager.SetParatextHelperAdapter(m_ptHelper);
 }
예제 #8
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Squeezes in the mock ParatextHelper in place of the real adapter.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void FixtureSetup()
		{
			base.FixtureSetup();
			m_ptHelper = new MockParatextHelper();
			ParatextHelper.Manager.SetParatextHelperAdapter(m_ptHelper);
		}