Notifies caller of writes to the std::err or std::out
Syntax
Event Data
The event handler receives an argument of type ProcessOutputEventArgs containing data related to this event. The following ProcessOutputEventArgs properties provide information specific to this event.
Property | Description |
---|
Data | Returns the line of text written to standard out/error |
Error | Returns true if the line of text was written to std::error |
Example
Library/Library.Test/TestAssemblyRunner.cs
C# | Copy Code |
---|
using (TempDirectory dir = new TempDirectory())
using (AssemblyRunner runner = new AssemblyRunner(Exe))
{
List<string> lines = new List<string>();
runner.OutputReceived += delegate(Object o, ProcessOutputEventArgs e) { lines.Add(e.Data); };
Assert.AreNotEqual(dir.TempPath, runner.WorkingDirectory);
runner.WorkingDirectory = dir.TempPath;
Assert.AreEqual(dir.TempPath, runner.WorkingDirectory);
int exitCode = runner.Run();
Assert.AreEqual(0, exitCode);
Assert.AreEqual("WorkingDirectory = " + dir.TempPath, lines[0]);
} |
VB.NET | Copy Code |
---|
Using dir As New TempDirectory()
Using runner As New AssemblyRunner(Exe)
Dim lines As New List(Of String)()
runner.OutputReceived += Function(o As [Object], e As ProcessOutputEventArgs) Do
lines.Add(e.Data)
End Function
Assert.AreNotEqual(dir.TempPath, runner.WorkingDirectory)
runner.WorkingDirectory = dir.TempPath
Assert.AreEqual(dir.TempPath, runner.WorkingDirectory)
Dim exitCode As Integer = runner.Run()
Assert.AreEqual(0, exitCode)
Assert.AreEqual("WorkingDirectory = " + dir.TempPath, lines(0))
End Using
End Using |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also