CreateNewLangProj() public method

public CreateNewLangProj ( ) : void
return void
Beispiel #1
0
        public void CreateNewLangProject()
        {
            DummyFwNewLangProject dlg = new DummyFwNewLangProject();

            string   dbName = "Maileingwij2025";
            FdoCache cache  = null;

            if (DbExists(dbName))
            {
                DestroyDb(dbName, true);
            }

            dlg.ProjectName = dbName;
            try
            {
                dlg.CreateNewLangProj();

                Assert.IsTrue(DbExists(dbName));

                //				// REVIEW: An FDO cache can not be created at this time until the scripture
                //				// object is created. This happens when the database is loaded.
                //				// Check to see if the writing systems were added correctly.
                //				cache = FdoCache.Create(dbName);
                //				Assert.AreEqual(dbName, cache.LangProject.Name.AnalysisDefaultWritingSystem);
                //				Assert.AreEqual(1, cache.LangProject.AnalysisWssRC.Count);
                //				Assert.AreEqual(1, cache.LangProject.VernWssRC.Count);
                //				Assert.AreEqual(1, cache.LangProject.CurAnalysisWssRS.Count);
                //				Assert.AreEqual(1, cache.LangProject.CurVernWssRS.Count);
                //
                //				foreach (LgWritingSystem ws in cache.LangProject.AnalysisWssRC)
                //				{
                //					Assert.AreEqual("something", ws.Name.GetAlternative(cache.DefaultUserWs));
                //				}
                //				foreach (LgWritingSystem ws in cache.LangProject.VernWssRC)
                //				{
                //					Assert.AreEqual(dbName, ws.Name.GetAlternative(cache.DefaultUserWs));
                //				}
                //				foreach (LgWritingSystem ws in cache.LangProject.CurAnalysisWssRS)
                //				{
                //					Assert.AreEqual("something", ws.Name.GetAlternative(cache.DefaultUserWs));
                //				}
                //				foreach (LgWritingSystem ws in cache.LangProject.CurVernWssRS)
                //				{
                //					Assert.AreEqual(dbName, ws.Name.GetAlternative(cache.DefaultUserWs));
                //				}

                cache = FdoCache.Create(dbName);
                CheckInitialSetOfPartsOfSpeech(cache);
            }
            finally
            {
                // Blow away the database to clean things up
                if (cache != null)
                {
                    cache.Dispose();
                }
                DestroyDb(dbName, false);
            }
        }
        public void CreateNewLangProject()
        {
            const string dbName          = "Maileingwij2025";
            string       storePath       = FdoFileHelper.GetWritingSystemDir(Path.Combine(FwDirectoryFinder.ProjectsDirectory, dbName));
            string       sharedStorePath = DirectoryFinder.GlobalWritingSystemStoreDirectory;

            using (var dlg = new DummyFwNewLangProject())
            {
                FdoCache cache = null;
                if (DbExists(dbName))
                {
                    DestroyDb(dbName, true);
                }

                dlg.setProjectName(dbName);
                try
                {
                    dlg.CreateNewLangProj();

                    Assert.IsTrue(DbExists(dbName));

                    // despite of the name is DummyProgressDlg no real dialog (doesn't derive from Control), so
                    // we don't need a 'using'
                    cache = FdoCache.CreateCacheFromExistingData(
                        new TestProjectId(FDOBackendProviderType.kXML, DbFilename(dbName)), "en", new DummyFdoUI(), FwDirectoryFinder.FdoDirectories,
                        new FdoSettings(), new DummyProgressDlg());
                    CheckInitialSetOfPartsOfSpeech(cache);

                    Assert.AreEqual(1, cache.ServiceLocator.WritingSystems.AnalysisWritingSystems.Count);
                    Assert.AreEqual("English", cache.ServiceLocator.WritingSystems.AnalysisWritingSystems.First().LanguageName);
                    Assert.AreEqual(1, cache.ServiceLocator.WritingSystems.CurrentAnalysisWritingSystems.Count);
                    Assert.AreEqual("English", cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.LanguageName);
                    Assert.AreEqual(1, cache.ServiceLocator.WritingSystems.VernacularWritingSystems.Count);
                    Assert.AreEqual("French", cache.ServiceLocator.WritingSystems.VernacularWritingSystems.First().LanguageName);
                    Assert.AreEqual(1, cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems.Count);
                    Assert.AreEqual("French", cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem.LanguageName);
                }
                finally
                {
                    // Blow away the database to clean things up
                    if (cache != null)
                    {
                        cache.Dispose();
                    }
                    DestroyDb(dbName, false);
                }
            }
        }
		public void CreateNewLangProject()
		{
			const string dbName = "Maileingwij2025";
			string storePath = FdoFileHelper.GetWritingSystemDir(Path.Combine(FwDirectoryFinder.ProjectsDirectory, dbName));
			string sharedStorePath = DirectoryFinder.GlobalWritingSystemStoreDirectory;

			using (var dlg = new DummyFwNewLangProject())
			{
				FdoCache cache = null;
				if (DbExists(dbName))
					DestroyDb(dbName, true);

				dlg.setProjectName(dbName);
				try
				{
					dlg.CreateNewLangProj();

					Assert.IsTrue(DbExists(dbName));

					// despite of the name is DummyProgressDlg no real dialog (doesn't derive from Control), so
					// we don't need a 'using'
					cache = FdoCache.CreateCacheFromExistingData(
						new TestProjectId(FDOBackendProviderType.kXML, DbFilename(dbName)), "en", new DummyFdoUI(), FwDirectoryFinder.FdoDirectories,
						new FdoSettings(), new DummyProgressDlg());
					CheckInitialSetOfPartsOfSpeech(cache);

					Assert.AreEqual(1, cache.ServiceLocator.WritingSystems.AnalysisWritingSystems.Count);
					Assert.AreEqual("English", cache.ServiceLocator.WritingSystems.AnalysisWritingSystems.First().LanguageName);
					Assert.AreEqual(1, cache.ServiceLocator.WritingSystems.CurrentAnalysisWritingSystems.Count);
					Assert.AreEqual("English", cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.LanguageName);
					Assert.AreEqual(1, cache.ServiceLocator.WritingSystems.VernacularWritingSystems.Count);
					Assert.AreEqual("French", cache.ServiceLocator.WritingSystems.VernacularWritingSystems.First().LanguageName);
					Assert.AreEqual(1, cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems.Count);
					Assert.AreEqual("French", cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem.LanguageName);
				}
				finally
				{
					// Blow away the database to clean things up
					if (cache != null)
						cache.Dispose();
					DestroyDb(dbName, false);
				}
			}
		}
		public void CreateNewLangProject()
		{
			DummyFwNewLangProject dlg = new DummyFwNewLangProject();

			string dbName = "Maileingwij2025";
			FdoCache cache = null;
			if (DbExists(dbName))
				DestroyDb(dbName, true);

			dlg.ProjectName = dbName;
			try
			{
				dlg.CreateNewLangProj();

				Assert.IsTrue(DbExists(dbName));

				//				// REVIEW: An FDO cache can not be created at this time until the scripture
				//				// object is created. This happens when the database is loaded.
				//				// Check to see if the writing systems were added correctly.
				//				cache = FdoCache.Create(dbName);
				//				Assert.AreEqual(dbName, cache.LangProject.Name.AnalysisDefaultWritingSystem);
				//				Assert.AreEqual(1, cache.LangProject.AnalysisWssRC.Count);
				//				Assert.AreEqual(1, cache.LangProject.VernWssRC.Count);
				//				Assert.AreEqual(1, cache.LangProject.CurAnalysisWssRS.Count);
				//				Assert.AreEqual(1, cache.LangProject.CurVernWssRS.Count);
				//
				//				foreach (LgWritingSystem ws in cache.LangProject.AnalysisWssRC)
				//				{
				//					Assert.AreEqual("something", ws.Name.GetAlternative(cache.DefaultUserWs));
				//				}
				//				foreach (LgWritingSystem ws in cache.LangProject.VernWssRC)
				//				{
				//					Assert.AreEqual(dbName, ws.Name.GetAlternative(cache.DefaultUserWs));
				//				}
				//				foreach (LgWritingSystem ws in cache.LangProject.CurAnalysisWssRS)
				//				{
				//					Assert.AreEqual("something", ws.Name.GetAlternative(cache.DefaultUserWs));
				//				}
				//				foreach (LgWritingSystem ws in cache.LangProject.CurVernWssRS)
				//				{
				//					Assert.AreEqual(dbName, ws.Name.GetAlternative(cache.DefaultUserWs));
				//				}

				cache = FdoCache.Create(dbName);
				CheckInitialSetOfPartsOfSpeech(cache);
			}
			finally
			{
				// Blow away the database to clean things up
				if (cache != null)
					cache.Dispose();
				DestroyDb(dbName, false);
			}
		}