public void TestEcho() { const string echoMsg = "Echo back what is given as argument"; commandLine = new CommandLine("cmd", "/C echo " + echoMsg, workingDirectoryForSVNTests); var commandLineOutput = commandLine.Execute(); Assert.IsFalse(commandLineOutput.Failed, "Should not fail echo"); Assert.AreEqual(echoMsg, commandLineOutput.OutputStr.TrimEnd(), "Echo matches"); }
public void TestRepository() { commandLine = new CommandLine("svn", "status --xml -v", workingDirectoryForSVNTests); var commandLineOutput = commandLine.Execute(); Assert.Greater(commandLineOutput.OutputStr.Length, 0, "empty output"); D.Log(commandLineOutput.OutputStr); var statusDatabase = SVNStatusXMLParser.SVNParseStatusXML(commandLineOutput.OutputStr); Assert.IsNotEmpty(statusDatabase.Keys, "statusDatabase not empty"); }
private CommandLineOutput ExecuteCommandLine(CommandLine commandLine) { CommandLineOutput commandLineOutput; try { //Debug.Log(commandLine.ToString()); commandLineOutput = commandLine.Execute(); return commandLineOutput; } catch (System.Threading.ThreadAbortException) { } catch (AppDomainUnloadedException) { } catch (Exception e) { D.Log("ERROR: Check that your commandline P4 client is installed correctly - " + e.Message); } return null; }
public void TestErrorHandling() { commandLine = new CommandLine("svn", "", workingDirectoryForSVNTests); var commandLineOutput = commandLine.Execute(); Assert.AreEqual(1, commandLineOutput.Exitcode, "commandLineOutput.exitcode"); Assert.AreEqual("Type 'svn help' for usage.", commandLineOutput.ErrorStr.TrimEnd(), "commandLineOutput.errorStr"); Assert.IsTrue(commandLineOutput.Failed, "commandLineOut.failed"); }
private CommandLineOutput ExecuteCommandLine(CommandLine commandLine) { CommandLineOutput commandLineOutput; try { D.Log(commandLine.ToString()); currentExecutingOperation = commandLine; //System.Threading.Thread.Sleep(500); // emulate latency to SVN server commandLineOutput = commandLine.Execute(); } catch (Exception e) { if (e.StackTrace.Contains("System.IO.MonoSyncFileStream/ReadDelegate")) { throw new VCMonoDebuggerAttachedException(e.Message, commandLine.ToString(), e); } throw new VCCriticalException(e.Message, commandLine.ToString(), e); } finally { currentExecutingOperation = null; } return commandLineOutput; }