Esempio n. 1
0
		private void TryLaunchApp(AppInfo app)
		{
			string exeFilePath = Path.Combine(GetAppExtractionDirectory(app), app.Name + ".exe");
			string exeDirectory = PathExtensions.GetAbsolutePath(Path.GetDirectoryName(exeFilePath));
			var processRunner = new ProcessRunner(exeFilePath) { WorkingDirectory = exeDirectory };
			processRunner.Start();
		}
Esempio n. 2
0
		public void ChangingWorkingDirectory()
		{
			var processRunner = new ProcessRunner("cmd.exe", "/c dir");
			processRunner.Start();
			var outputWithDefaultWorkingDirectory = processRunner.Output;
			processRunner.WorkingDirectory = @"C:\";
			processRunner.Start();
			var outputWithDefinedWorkingDirectory = processRunner.Output;
			Assert.AreNotEqual(outputWithDefaultWorkingDirectory, outputWithDefinedWorkingDirectory);
		}
Esempio n. 3
0
		public void StandardOutputEvent()
		{
			var logger = new MockLogger();
			var processRunner = new ProcessRunner("cmd.exe", "/c dir");
			processRunner.StandardOutputEvent +=
				outputMessage => logger.Write(Logger.MessageType.Info, outputMessage);
			processRunner.Start();
			Assert.IsTrue(
				logger.LastMessage.Contains("Dir(s)") || logger.LastMessage.Contains("Verzeichnis(se)"),
				logger.LastMessage);
		}
		private static void RunAdbProcess(ProcessRunner adbProcess)
		{
			try
			{
				TryRunAdbProcess(adbProcess);
			}
			catch (ProcessRunner.ProcessTerminatedWithError)
			{
				Logger.Warning("Output:" + adbProcess.Output);
				Logger.Warning("Error:" + adbProcess.Errors);
				throw;
			}
		}
Esempio n. 5
0
 protected override void LaunchApp(AppInfo app)
 {
     try
     {
         string exeFilePath = Path.Combine(GetAppExtractionDirectory(app), app.Name + ".exe");
         string exeDirectory = PathExtensions.GetAbsolutePath(Path.GetDirectoryName(exeFilePath));
         var processRunner = new ProcessRunner(exeFilePath) { WorkingDirectory = exeDirectory };
         processRunner.Start();
     }
     catch (Exception ex)
     {
         Logger.Warning(app.Name + " was closed with error: " + ex);
     }
 }
Esempio n. 6
0
		public void TestTimeout()
		{
			var processRunner = new ProcessRunner("cmd.exe", "/c dir", 1);
			Assert.Throws<ProcessRunner.StandardOutputHasTimedOutException>(processRunner.Start);
		}
Esempio n. 7
0
		public void DefaultWorkingDirectory()
		{
			var processRunner = new ProcessRunner("cmd.exe", "/c dir");
			Assert.AreEqual(Environment.CurrentDirectory, processRunner.WorkingDirectory);
		}
		private static void TryRunAdbProcess(ProcessRunner adbProcess)
		{
			adbProcess.Start();
		}