public void CreateNewLangProject_NameDoesNotHaveNonAsciiCharsRemoved() { using (var dlg = new DummyFwNewLangProject()) { const string dbName = "Fran\u00e7ais"; if (DbExists(dbName)) { DestroyDb(dbName, true); } dlg.ProjectName = dbName; try { dlg.SimulatedNonAsciiDialogResult = DialogResult.OK; dlg.Show(); Application.DoEvents(); dlg.TestOkButton(); Assert.IsTrue(dlg.NonAsciiWarningWasActivated, "Non-Ascii Project Name should activate the non-Ascii warning."); Assert.AreEqual(dbName, dlg.ProjectName, "Project Name should not have non-ASCII character removed."); } finally { dlg.Close(); // Blow away the database to clean things up DestroyDb(dbName, false); } } }
public void CreateNewLangProject_NameHasMultipleNonAsciiCharsRemoved() { using (var dlg = new DummyFwNewLangProject()) { const string dbName = "Fra\u014b\u00e7a\u01b4s\u028c"; // get around changing file type if (DbExists(dbName)) { DestroyDb(dbName, true); } dlg.ProjectName = dbName; try { dlg.SimulatedNonAsciiDialogResult = DialogResult.Cancel; dlg.Show(); Application.DoEvents(); dlg.TestOkButton(); Assert.IsTrue(dlg.NonAsciiWarningWasActivated, "Non-Ascii Project Name should activate the non-Ascii warning."); Assert.AreEqual("Fraas", dlg.ProjectName, "Project Name should have had four non-ASCII characters removed."); } finally { dlg.Close(); // Blow away the database to clean things up DestroyDb(dbName, false); } } }
public void CreateNewLangProject_NameDoesntTriggerNonAsciiWarning() { using (var dlg = new DummyFwNewLangProject()) { const string dbName = "Simple"; if (DbExists(dbName)) { DestroyDb(dbName, true); } dlg.ProjectName = dbName; try { dlg.Show(); Application.DoEvents(); dlg.TestOkButton(); Assert.IsFalse(dlg.NonAsciiWarningWasActivated, "Ascii-only Project Name should not activate the non-Ascii warning."); } finally { dlg.Close(); // Blow away the database to clean things up DestroyDb(dbName, false); } } }
public void CreateNewLangProject_NameTriggersNonAsciiWarning() { const string dbName = "Fran\u00e7ais"; using (var dlg = new DummyFwNewLangProject()) { dlg.ProjectName = dbName; if (DbExists(dbName)) { DestroyDb(dbName, true); } try { dlg.Show(); Application.DoEvents(); dlg.TestOkButton(); Assert.IsTrue(dlg.NonAsciiWarningWasActivated, "Project Name should have activated the non-Ascii warning."); } finally { dlg.Close(); // Blow away the database to clean things up 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); } }
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_NameTooLong() { using (var dlg = new DummyFwNewLangProject()) { dlg.ProjectName = "This name will be too long by one character.567890123456789012345"; Assert.Greater(dlg.ProjectName.Length, dlg.MaxProjectNameLength, "Constant maximum Project Name length has changed. Test may need to be modified."); try { dlg.Show(); Application.DoEvents(); dlg.TestOkButton(); Assert.IsEmpty(dlg.ProjectName, "Project Name should have been cleared out."); } finally { dlg.Close(); } } }
public void CreateNewLangProject_NameHasMultipleNonAsciiCharsRemoved() { using (var dlg = new DummyFwNewLangProject()) { const string dbName = "Fra\u014b\u00e7a\u01b4s\u028c"; // get around changing file type if (DbExists(dbName)) DestroyDb(dbName, true); dlg.setProjectName(dbName); try { dlg.SimulatedNonAsciiDialogResult = DialogResult.Cancel; dlg.Show(); Application.DoEvents(); dlg.TestOkButton(); Assert.IsTrue(dlg.NonAsciiWarningWasActivated, "Non-Ascii Project Name should activate the non-Ascii warning."); Assert.AreEqual("Fraas", dlg.ProjectName, "Project Name should have had four non-ASCII characters removed."); } finally { dlg.Close(); // Blow away the database to clean things up DestroyDb(dbName, false); } } }
public void CreateNewLangProject_NameDoesNotHaveNonAsciiCharsRemoved() { using (var dlg = new DummyFwNewLangProject()) { const string dbName = "Fran\u00e7ais"; if (DbExists(dbName)) DestroyDb(dbName, true); dlg.setProjectName(dbName); try { dlg.SimulatedNonAsciiDialogResult = DialogResult.OK; dlg.Show(); Application.DoEvents(); dlg.TestOkButton(); Assert.IsTrue(dlg.NonAsciiWarningWasActivated, "Non-Ascii Project Name should activate the non-Ascii warning."); Assert.AreEqual(dbName, dlg.ProjectName, "Project Name should not have non-ASCII character removed."); } finally { dlg.Close(); // Blow away the database to clean things up DestroyDb(dbName, false); } } }
public void CreateNewLangProject_NameDoesntTriggerNonAsciiWarning() { using (var dlg = new DummyFwNewLangProject()) { const string dbName = "Simple"; if (DbExists(dbName)) DestroyDb(dbName, true); dlg.setProjectName(dbName); try { dlg.Show(); Application.DoEvents(); dlg.TestOkButton(); Assert.IsFalse(dlg.NonAsciiWarningWasActivated, "Ascii-only Project Name should not activate the non-Ascii warning."); } finally { dlg.Close(); // Blow away the database to clean things up DestroyDb(dbName, false); } } }
public void CreateNewLangProject_NameTriggersNonAsciiWarning() { const string dbName = "Fran\u00e7ais"; using (var dlg = new DummyFwNewLangProject()) { dlg.setProjectName(dbName); if (DbExists(dbName)) DestroyDb(dbName, true); try { dlg.Show(); Application.DoEvents(); dlg.TestOkButton(); Assert.IsTrue(dlg.NonAsciiWarningWasActivated, "Project Name should have activated the non-Ascii warning."); } finally { dlg.Close(); // Blow away the database to clean things up 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); } }