Esempio n. 1
0
 public void TestCmd()
 {
     var cmd = new ProcessParameters("cmd /c dir", "c:\\");
       Assert.AreEqual("c:\\windows\\system32\\cmd.exe", cmd.Executable.ToLower());
       Assert.AreEqual("c:\\", cmd.Directory);
       Assert.AreEqual("/c dir", cmd.Parameters);
 }
Esempio n. 2
0
        public void Test()
        {
            var cmd = new ProcessParameters("mytest.exe one two three", "c:\\");
              Assert.AreEqual("c:\\mytest.exe", cmd.Executable);
              Assert.AreEqual("c:\\", cmd.Directory);
              Assert.AreEqual("one two three", cmd.Parameters);

              cmd = new ProcessParameters("mytest.exe", "c:\\windows\\system32");
              Assert.AreEqual("c:\\windows\\system32\\mytest.exe", cmd.Executable);
              Assert.AreEqual("c:\\windows\\system32", cmd.Directory);
              Assert.AreEqual("", cmd.Parameters);

              cmd = new ProcessParameters(".\\mytest.exe", "c:\\windows\\system32");
              Assert.AreEqual("c:\\windows\\system32\\mytest.exe", cmd.Executable);
              Assert.AreEqual("c:\\windows\\system32", cmd.Directory);
              Assert.AreEqual("", cmd.Parameters);

              cmd = new ProcessParameters("..\\mytest.exe", "c:\\windows\\system32");
              Assert.AreEqual("c:\\windows\\mytest.exe", cmd.Executable);
              Assert.AreEqual("c:\\windows", cmd.Directory);
              Assert.AreEqual("", cmd.Parameters);

              cmd = new ProcessParameters("..\\..\\mytest.exe", "c:\\windows\\system32");
              Assert.AreEqual("c:\\mytest.exe", cmd.Executable);
              Assert.AreEqual("c:\\", cmd.Directory);
              Assert.AreEqual("", cmd.Parameters);

              cmd = new ProcessParameters("c:\\mytest.exe", "c:\\windows\\system32");
              Assert.AreEqual("c:\\mytest.exe", cmd.Executable);
              Assert.AreEqual("c:\\", cmd.Directory);
              Assert.AreEqual("", cmd.Parameters);

              cmd = new ProcessParameters("c:\\local\\mytest.exe", "c:\\windows\\system32");
              Assert.AreEqual("c:\\local\\mytest.exe", cmd.Executable);
              Assert.AreEqual("c:\\local", cmd.Directory);
              Assert.AreEqual("", cmd.Parameters);
        }
Esempio n. 3
0
 public void VerifyExecutableExists()
 {
     var process = new ProcessParameters(Command, Settings.Home);
       if (!File.Exists(process.Executable))
     Logger.Warn("File " + process.Executable + " does not seem to exist");
 }
Esempio n. 4
0
 public ProcessWrapper(string command, string directory, bool redirectErrors, bool redirectAllOutput)
 {
     Command = new ProcessParameters(command, directory);
       RedirectAllOutput = redirectAllOutput;
       RedirectErrors = redirectErrors;
 }