private static void initializeTestProperties(string testPropertiesFile) { if (!string.IsNullOrEmpty(testPropertiesFile)) { Uri testPropertiesUri = loadTestProperties(testPropertiesFile); if (testPropertiesUri == null) { TestProperties.Initialize(); } } else { TestProperties.Initialize(); } if (!string.IsNullOrEmpty(testEnvironments)) { var testPropertyOverrides = TestProperties.GetTestProperityOverrides(testEnvironments); if (testPropertyOverrides != null) { TestProperties.ApplyTestPropertyOverrides(testPropertyOverrides); } else { LogEvent.Info($"The test environment \"{testEnvironments }\" has been specified, " + "however it was not located in the application configuration file."); exitCode = ExitCode.TestPropertiesError; } } }
private static Uri loadTestProperties(string testPropertiesFile) { Uri testPropertiesUri = null; try { testPropertiesUri = new Uri(testPropertiesFile); TestProperties.Initialize(testPropertiesUri.LocalPath); } catch (FileNotFoundException) { LogEvent.Fatal( string.Format("Unable to locate test properties file \"{0}\".\r\n\r\nPlease verify the file path.", testPropertiesFile)); testPropertiesUri = null; exitCode = ExitCode.TestPropertiesError; } catch (SerializationException) { LogEvent.Fatal( string.Format("Unable to deserialize test properties \"{0}\".\r\n\r\nPlease verify the file is a valid test properties file.", testPropertiesFile)); testPropertiesUri = null; exitCode = ExitCode.TestPropertiesError; } catch (UriFormatException) { LogEvent.Fatal( string.Format("Unable to read test properties \"{0}\".\r\n\r\nPlease verify the file is a valid test properties file.", testPropertiesFile)); exitCode = ExitCode.TestPropertiesError; } catch (Exception e) { LogEvent.Fatal(e.Message); testPropertiesUri = null; exitCode = ExitCode.TestPropertiesError; } return(testPropertiesUri); }
private void initializeTestProperties() { if (!string.IsNullOrEmpty(Program.TestPropertiesFile)) { Uri testPropertiesUri = loadTestProperties(Program.TestPropertiesFile); if (testPropertiesUri != null) { m_testPropertiesUri = testPropertiesUri; m_testPropertiesStatusBarLabel.Text = Path.GetFileName(m_testPropertiesUri.LocalPath); } else { TestProperties.Initialize(); m_testPropertiesStatusBarLabel.Text = "Default test properties"; } } else { TestProperties.Initialize(); m_testPropertiesStatusBarLabel.Text = "Default test properties"; } if (!string.IsNullOrEmpty(Program.TestEnvironments)) { _testPropertyOverrides = TestProperties.GetTestProperityOverrides(Program.TestEnvironments); if (_testPropertyOverrides != null) { var unused = TestProperties.ApplyTestPropertyOverrides(_testPropertyOverrides); if (unused.Count > 0) { displayUnusedOverridesMessage(unused); } } else { MessageBox.Show(this, $"The test environment \"{Program.TestEnvironments }\" has been specified, " + "however it was not located in the application configuration file.", "Quintity TestEngineer", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void newTestProperties(string filePath = null) { if (filePath is null) { TestProperties.Initialize(); } else { TestProperties.Initialize(filePath); } TestProperties.ApplyTestPropertyOverrides(_testPropertyOverrides); _initialLoading = true; loadDataGrid(); this.m_cancelButton.Text = "Close"; }
private Uri loadTestProperties(string testPropertiesFile) { Uri testPropertiesUri = null; try { testPropertiesUri = new Uri(testPropertiesFile); TestProperties.Initialize(testPropertiesUri.LocalPath); } catch (FileNotFoundException) { MessageBox.Show( string.Format("Unable to locate test properties file \"{0}\".\r\n\r\nPlease verify the file path.", testPropertiesFile), "Quintity TestEngineer", MessageBoxButtons.OK, MessageBoxIcon.Warning); testPropertiesUri = null; } catch (SerializationException) { MessageBox.Show( string.Format("Unable to deserialize test properties \"{0}\".\r\n\r\nPlease verify the file is a valid test properties file.", testPropertiesFile), "Quintity TestEngineer", MessageBoxButtons.OK, MessageBoxIcon.Warning); testPropertiesUri = null; } catch (UriFormatException) { MessageBox.Show( string.Format("Unable to read test properties \"{0}\".\r\n\r\nPlease verify the file is a valid test properties file.", testPropertiesFile), "Quintity TestEngineer", MessageBoxButtons.OK, MessageBoxIcon.Warning); } catch (Exception e) { MessageBox.Show(e.Message, "Quintity TestEngineer", MessageBoxButtons.OK, MessageBoxIcon.Warning); testPropertiesUri = null; } return(testPropertiesUri); }
private void m_unloadTestPropertiesMenuItem_Click(object sender, EventArgs e) { TestProperties.Initialize(); m_testPropertiesStatusBarLabel.Text = "Default test properties"; }