Exemple #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();
		}
		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);
		}
		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;
			}
		}
Exemple #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);
     }
 }
		public void TestTimeout()
		{
			var processRunner = new ProcessRunner("cmd.exe", "/c dir", 1);
			Assert.Throws<ProcessRunner.StandardOutputHasTimedOutException>(processRunner.Start);
		}
		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();
		}