Added StandardOutput property to IProcess
Improved IProcess, ProcessWrap and unit tests.
This commit is contained in:
Родитель
887426a468
Коммит
9bb72ab955
|
@ -1,5 +1,6 @@
|
|||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using SystemInterface.IO;
|
||||
|
||||
namespace SystemInterface.Diagnostics
|
||||
{
|
||||
|
@ -62,6 +63,16 @@ namespace SystemInterface.Diagnostics
|
|||
/// <returns>true if the associated process has reached an idle state.</returns>
|
||||
bool WaitForInputIdle();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a stream used to read the output of the application.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// A <see cref="IStreamReader"/> implementation that can be used
|
||||
/// to read the standard output stream of the application.
|
||||
/// </value>
|
||||
[MonitoringDescription("ProcessStandardOutput"), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)]
|
||||
IStreamReader StandardOutput { get; }
|
||||
|
||||
/*
|
||||
|
||||
// Events
|
||||
|
|
|
@ -30,5 +30,17 @@ namespace SystemWrapper.Tests.IO
|
|||
Assert.AreNotSame(origInfo, instance.ProcessInstance);
|
||||
Assert.IsNotNull(instance.ProcessInstance);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(System.InvalidOperationException))]
|
||||
public void StandardOutput_NotNull_ThrowsExceptionBecauseProcessNotYetStarted()
|
||||
{
|
||||
var instance = new ProcessWrap();
|
||||
var origInfo = instance.ProcessInstance;
|
||||
instance.Initialize();
|
||||
Assert.AreNotSame(origInfo, instance.ProcessInstance);
|
||||
Assert.IsNotNull(instance.ProcessInstance);
|
||||
Assert.IsNotNull(instance.StandardOutput);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using SystemInterface.Diagnostics;
|
||||
using SystemInterface.IO;
|
||||
|
||||
namespace SystemWrapper.Diagnostics
|
||||
{
|
||||
|
@ -58,6 +60,15 @@ namespace SystemWrapper.Diagnostics
|
|||
set { this._startInfo = value; }
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IStreamReader StandardOutput
|
||||
{
|
||||
get
|
||||
{
|
||||
return new IO.StreamReaderWrap(ProcessInstance.StandardOutput);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void WaitForExit()
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче