Exemplo n.º 1
0
 /// <summary>
 /// Performs the calculation by starting a Hydra-Ring process.
 /// </summary>
 /// <param name="workingDirectory">The directory of the process.</param>
 /// <param name="hydraRingInitializationService">The <see cref="HydraRingConfigurationService"/>.</param>
 /// <exception cref="Win32Exception">Thrown when there was an error in opening the associated file
 /// or the wait setting could not be accessed.</exception>
 private void PerformCalculation(string workingDirectory, HydraRingInitializationService hydraRingInitializationService)
 {
     hydraRingProcess = HydraRingProcessFactory.Create(
         hydraRingInitializationService.MechanismComputationExeFilePath,
         hydraRingInitializationService.IniFilePath,
         workingDirectory);
     hydraRingProcess.Start();
     hydraRingProcess.WaitForExit();
     hydraRingProcess.Close();
     hydraRingProcess = null;
 }
        public void Create_ReturnsExpectedProcess()
        {
            // Call
            const string iniFilePath      = "D:\\iniFile.text";
            const string workingDirectory = "D:\\workingDirectory";
            const string mechanismComputationExeFilePath = "D:\\mechanismComputation.exe";

            Process process = HydraRingProcessFactory.Create(mechanismComputationExeFilePath, iniFilePath, workingDirectory);

            // Assert
            Assert.AreEqual(mechanismComputationExeFilePath, process.StartInfo.FileName);
            Assert.AreEqual(iniFilePath, process.StartInfo.Arguments);
            Assert.AreEqual(workingDirectory, process.StartInfo.WorkingDirectory);
            Assert.IsFalse(process.StartInfo.UseShellExecute);
            Assert.IsTrue(process.StartInfo.CreateNoWindow);
            Assert.IsTrue(process.StartInfo.RedirectStandardInput);
            Assert.IsTrue(process.StartInfo.RedirectStandardOutput);
            Assert.IsTrue(process.StartInfo.RedirectStandardError);
        }