Inheritance Hierarchy
DeltaEngine.Tests.Core ProcessRunnerTests
Namespace: DeltaEngine.Tests.Core
Assembly: DeltaEngine.Tests (in DeltaEngine.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The ProcessRunnerTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
ProcessRunnerTests | Initializes a new instance of the ProcessRunnerTests class |
Methods
Name | Description | |
---|---|---|
ChangingWorkingDirectory | ||
DefaultWorkingDirectory | ||
StandardOutputEvent | ||
TestTimeout |
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