ProcessRunnerTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Tests.Core ProcessRunnerTests

Namespace: DeltaEngine.Tests.Core
Assembly: DeltaEngine.Tests (in DeltaEngine.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class ProcessRunnerTests

The ProcessRunnerTests type exposes the following members.

Constructors

  NameDescription
Public methodProcessRunnerTests
Initializes a new instance of the ProcessRunnerTests class
Top
Methods

  NameDescription
Public methodChangingWorkingDirectory
Public methodDefaultWorkingDirectory
Public methodStandardOutputEvent
Public methodTestTimeout
Top
Examples

[Test]
public void DefaultWorkingDirectory()
{
    var processRunner = new ProcessRunner("cmd.exe", "/c dir");
    Assert.AreEqual(Environment.CurrentDirectory, processRunner.WorkingDirectory);
}
[Test]
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);
}
[Test]
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);
}
[Test]
public void TestTimeout()
{
    var processRunner = new ProcessRunner("cmd.exe", "/c dir", 1);
    Assert.Throws<ProcessRunner.StandardOutputHasTimedOutException>(processRunner.Start);
}
See Also