public void VerifyPowerShellProcessInfoWithScriptsDirectoryConfigured() { ProcessInfo info = null; ProcessResult processResult = new ProcessResult("output", "error", 0, false); mockProcessExecutor.Setup(executor => executor.Execute(It.IsAny <ProcessInfo>())). Callback <ProcessInfo>(processInfo => info = processInfo).Returns(processResult).Verifiable(); mytask.Executable = POWERSHELL_PATH; mytask.Script = "MyScript.ps1"; mytask.ConfiguredScriptsDirectory = @"D:\CruiseControl"; mytask.Run(IntegrationResult()); Assert.AreEqual(POWERSHELL_PATH, info.FileName); Assert.AreEqual(PowerShellTask.DefaultBuildTimeOut * 1000, info.TimeOut); CustomAssertion.AssertStartsWith(@"-nologo -NoProfile -NonInteractive -file ""D:\CruiseControl\MyScript.ps1""", info.Arguments); }
public void VerifyPowerShellProcessInfoWithScriptsDirectoryConfigured() { CollectingConstraint constraint = new CollectingConstraint(); ProcessResult processResult = new ProcessResult("output", "error", 0, false); mockProcessExecutor.ExpectAndReturn("Execute", processResult, new object[] { constraint }); mytask.Executable = POWERSHELL_PATH; mytask.Script = "MyScript.ps1"; mytask.ConfiguredScriptsDirectory = @"D:\CruiseControl"; mytask.Run(IntegrationResult()); ProcessInfo info = (ProcessInfo)constraint.Parameter; Assert.AreEqual(POWERSHELL_PATH, info.FileName); Assert.AreEqual(PowerShellTask.DefaultBuildTimeOut * 1000, info.TimeOut); CustomAssertion.AssertStartsWith(@"-nologo -NoProfile -NonInteractive -file ""D:\CruiseControl\MyScript.ps1""", info.Arguments); }