CSharpTest.Net
RunFormatArgs Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Processes Namespace > ProcessRunner Class : RunFormatArgs Method

formatArgs

Glossary Item Box

Calls String.Format() for each argument this runner was constructed with giving the object array as the arguments. Once complete it runs the process with the new set of arguments and returns the exit code.

Syntax

Visual Basic (Declaration) 
Public Function RunFormatArgs( _
   ByVal ParamArray formatArgs() As Object _
) As Integer
C# 
public int RunFormatArgs( 
   params object[] formatArgs
)

Parameters

formatArgs

Example

Library/Library.Test/TestProcessRunner.cs

C#Copy Code
string tempfile = Path.GetTempFileName();
try
{
    ProcessRunner runner = new ProcessRunner("cmd.exe", "/C", "ECHO", "Hello", ">{0}");

    runner.StartFormatArgs(tempfile);
    Assert.AreEqual(0, runner.ExitCode);

    string output = File.ReadAllText(tempfile).Trim();
    Assert.AreEqual("Hello", output);

    File.Delete(tempfile);
    Assert.AreEqual(0, runner.RunFormatArgs(tempfile));

    output = File.ReadAllText(tempfile).Trim();
    Assert.AreEqual("Hello", output);
}
finally
{ File.Delete(tempfile); }
VB.NETCopy Code
Dim tempfile As String = Path.GetTempFileName()
Try
    Dim runner As New ProcessRunner("cmd.exe", "/C", "ECHO", "Hello", ">{0}")

    runner.StartFormatArgs(tempfile)
    Assert.AreEqual(0, runner.ExitCode)

    Dim output As String = File.ReadAllText(tempfile).Trim()
    Assert.AreEqual("Hello", output)

    File.Delete(tempfile)
    Assert.AreEqual(0, runner.RunFormatArgs(tempfile))

    output = File.ReadAllText(tempfile).Trim()
    Assert.AreEqual("Hello", output)
Finally
    File.Delete(tempfile)
End Try

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Reference

ProcessRunner Class
ProcessRunner Members

Used By

TestResXtoMc.TestBuildMcFromResX()

Source Code

Library/Processes/ProcessRunner.cs

Generated with Document! X 2011 by Innovasys